Split string based on the first occurrence of the character

Suppose we have a string as "a,b,c,d,e" and want to split it as two strings "a","b,c,d,e"  i.e only with the first occurrence of the comma,  then we can use the following

var myString="a,b,c,d,e";
var values= myString.Split(new[] { ',' }, 2);

Gopikrishna

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment