Split string var

Posted by lidermin on Stack Overflow See other posts from Stack Overflow or by lidermin
Published on 2010-03-12T18:32:24Z Indexed on 2010/03/12 18:37 UTC
Read the original article Hit count: 198

Filed under:
|
|

Hi, I have a question:

Let's say I have this string var:

string strData = "1|2|3|4||a|b|c|d"

Then, I make a Split:

strNumbers[] = strData.Split("||"); //something like this, I know It's not this simple

I need two separate parts, each one containing this:

//strNumbers -> {"1","2","3","4"},{"a","b","c","d"}

So that after that, I could do this:

string[] strNumArray[] = strNumbers[0].Split('|');
//strNumArray -> '1', '2', '3', '4'

And same with the other part (letters).

Is it possible? to make this double split with the same character, but the first time the character is repeated twice?.

Thanks.

PD. I'm using C#.

© Stack Overflow or respective owner

Related posts about splitting

Related posts about string-manipulation