I am testing to cut the strings via C#, but I am not getting the results correctly.
It is still showing the full text exactString.
String exactString = ABC@@^^@@DEF
char[] Delimiter = { '@', '@', '^', '^', '@', '@' };
string getText1 = exactString.TrimEnd(Delimiter);
string getText2 = exactString.TrimStart(Delimiter);
MessageBox.Show(getText1);
MessageBox.Show(getText2);
OUTPUT:
ABC@@^^@@DEF for both getText1 and getText2.
Correct OUTPUT should be
ABC for getText1 and DEF for getText2.
How do I fix it?
Thanks.
You want to split your string, not trim it. Thus, the correct method to use is
String.Split: