i'm really not used to the split string method in c# and i was wondering how come there's no split by more than one char function?
and my attempt to try to split this string below using regex has just ended up in frustration. anybody can help me?
basically i want to split the string below down to
aa**aa**bb**dd^__^a2a**a2a**b2b**dd^__^
into
aa**aa**bb**dd
a2a**a2a**b2b**dd
and then later into
aa
aa
bb
dd
a2a
a2a
b2b
dd
thanks!
You can split using a string[]
. There are several overloads.
string[] splitBy = new string[] {"^__^"};
string[] result = "aa*aa*bb*dd^__^a2a*a2a*b2b*dd^__^".Split(splitBy, StringSplitOptions.None);
// result[0] = "aa*aa*bb*dd", result[1] = "a2a*a2a*b2b*dd"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With