c# - Splitting on multiple characters at once -
i know possible split string on character like:
string[] s = somestring.split(',');
if know format of strings going comma delimited, or new line delimited, can handle both of these once? can both done @ once?
i.e:
a, b, c, d, e, f, g
or:
a b c d e
or:
a, b, c, d, e f
how can split on multiple characters @ once?
the string split() method takes has override accepts array of characters split on.
string[] s = somestring.split(new [] { ',', '\n' });
also, optional parameter stringsplitoptions value. allows specify if you'd remove blank/empty entries.
Comments
Post a Comment