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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -