Effective way of String splitting

Posted by openidsujoy on Stack Overflow See other posts from Stack Overflow or by openidsujoy
Published on 2010-05-22T04:38:10Z Indexed on 2010/05/22 6:10 UTC
Read the original article Hit count: 184

Filed under:
|
|
|

I have a completed string like this

N:Pay in Cash++RGI:40++R:200++T:Purchase++IP:N++IS:N++PD:PC++UCP:598.80++UPP:0.00++TCP:598.80++TPP:0.00++QE:1++QS:1++CPC:USD++PPC:Points++D:Y++E:Y++IFE:Y++AD:Y++IR:++MV:++CP:~ ~N:ERedemption++RGI:42++R:200++T:Purchase++IP:N++IS:N++PD:PC++UCP:598.80++UPP:0.00++TCP:598.80++TPP:0.00++QE:1++QS:1++CPC:USD++PPC:Points++D:Y++E:Y++IFE:Y++AD:Y++IR:++MV:++CP:

this string is like this

  1. It's list of PO's(Payment Options) which are separated by ~~
  2. this list may contains one or more
  3. PO contains only Key-Value Pairs which separated by :
  4. spaces are denoted by ++

I need to extract the values for Key "RGI" and "N".

I can do it via for loop , I want a efficient way to do this. any help on this.

© Stack Overflow or respective owner

Related posts about c#

Related posts about string-parsing