Tuesday, August 30, 2022

[FIXED] how to get text after a certain comma on C#?

Issue

Ok guys so I've got this issue that is driving me nuts, lets say that I've got a string like this "aaa,bbb,ccc,ddd,eee,fff,ggg" (with out the double quotes) and all that I want to get is a sub-string from it, something like "ddd,eee,fff,ggg".

I also have to say that there's a lot of information and not all the strings look the same so i kind off need something generic.

thank you!


Solution

I would use stringToSplit.Split(',')

Update:

var startComma = 3;    
var value = string.Join(",", stringToSplit.Split(',').Where((token, index) => index > startComma));


Answered By - Rob10e
Answer Checked By - Terry (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.