Split a string based on first occurrence of character

Split a string based on first occurrence of character

Suppose you have a string wherein a particular character is repeated many times but u want to split
it only at the first occurance

String value=”Name:Chaithra:Age-10”

string[] actualValue = value.Split(new char[] { ':' }, 2);

output-
actualValue[0]= Name
//observe that it has not split again.

actualValue[1]= Chaithra:Age-10

1 comment: