Search code examples
c#csvsplittrim

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


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));