When we want to split a sting for any kind of reasons, we (at least myself) tend to split using the (pipe) |
character as it is very rare to find out someone or that the application uses it on a string ... but what happens if it uses?
Well, a simple Crash will be thrown :)
I found out that a college uses non-printable chars to do the same technique, for example:
String.Format(
"{1}{0}{2}{0}{3}{0}{4}",
(char)2,
myFirstString,
mySecondString,
myThirdString,
myFourthString);
and when we want to extract the hole string into it's parts
String.Split((char)2);
Is this safe? Should I adopt this way of safely splitting string? Is there any other safety technique?