Re: How to get a part of a string using reg exp
- From: "Daniel" <DanielV@xxxxxxxxxxxxxxxx>
- Date: Wed, 14 Jun 2006 17:25:03 +0100
Yep.
Get the substring, parse it to an int, increment it, then turn it back into
a string and put it back in.
Havent compiled this but this should work:
string s = "00sddsd00021dsd";
string theNum = s.Substring(7, 5);
int intNum = int.Parse(theNum);
intNum++;
string finalString = s.Replace(theNum, intNum.ToString());
"Mike9900" <Mike9900@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C464180F-8CCD-4AD4-81E0-B146F33285DE@xxxxxxxxxxxxxxxx
I need to get 00021 in "00sddsd00021dsd" and then increment it to become
"00sddsd00022dsd". Is there a way?
--
Mike
.
- Follow-Ups:
- Re: How to get a part of a string using reg exp
- From: Göran Andersson
- Re: How to get a part of a string using reg exp
- Prev by Date: Re: StringBuilder OutOfMemory
- Next by Date: Re: How to get a part of a string using reg exp
- Previous by thread: can someone clarify the foreach for me pls
- Next by thread: Re: How to get a part of a string using reg exp
- Index(es):
Relevant Pages
|