How to spilt string with string as a separator using c#
It's easy to split a string using character but sometimes the separator may present in the string with not as separator then at that time result comes as wrong.To avoid this kind of error use string with unique combination like "$#%$" or "$%%^^" .There may a less possibility of presence of this kind of string inside your string,But if you can't separate it with the way you separate using char as separator.
Here is the sample :
string[] arrStr = typeOfrecord.Split(new string[] {"#$%^"}, StringSplitOptions.None);
Note: typeOfrecord is the string containing the separator as "#$%^".
Comments
Post a Comment