c# - How do I grab the last string from a index by detecting the comma? -
how grab last string index detecting comma? example: string = a,b,c,d or = ab, cd, ef, gh (the string of can dynamic) how last string i?? (i need answer c# , using low consume performance ways possible)
result: = ad, cd, ef b = gh
you can use string.substring along string.lastindexof method (char) index of last comma
string last = str.substring(str.lastindexof(',')+1)
Comments
Post a Comment