How to Split and strip into multiple variables?

Posted by Khou on Stack Overflow See other posts from Stack Overflow or by Khou
Published on 2010-03-09T11:48:43Z Indexed on 2010/03/09 11:51 UTC
Read the original article Hit count: 396

Filed under:
|
|
|

How to Split and strip X string values into separate variables?

X has string value of

itemA=myvalue&itemB=anothervalue&itemC=andanother

I have 3 strings (var1,var2,var3) to hold the values of the stripped values.

Find in string X "itemA=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var1)

Find in string X "itemB=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var2)

Find in string X "itemB=" copy everything after "=" character until "&" character OR if no "&" character is found copy until end of string (store this value into var3)

© Stack Overflow or respective owner

Related posts about c#

Related posts about string