Re: How to get a part of a string using reg exp

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... conformant string. ... int repeats, reps; ... ref satisfierLength); ...
    (comp.programming)
  • RE: Controling Modal Dialogs (Solution)
    ... doesn't return until the 'modal' browser returns. ... string varOptions) ... public void DocumentComplete ... int rc = winDisp.Invoke(rgDispId, ref guid, 0, ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Gcc compatible header file
    ... A string collection is a table of zero terminated strings that will grow ... typedef struct _StringCollection StringCollection; ... int; ... bool; ...
    (comp.lang.c)
  • Kernighan and Pikes "Beautiful" Code
    ... conformant string. ... int repeats, reps; ... ref satisfierLength); ...
    (comp.programming)
  • Re: FTP CD command
    ... public const int GENERIC_WRITE = 0x40000000; ... string lpszProxyName, ... public static extern IntPtr InternetConnect ( ... public static extern bool FtpGetCurrentDirectory ( ...
    (microsoft.public.dotnet.languages.vb)