Re: Does anyone know how to split a string...
From: Alexander Shirshov (alexander_at_omnitalented.com)
Date: 03/10/05
- Next message: X-Killer: "Re: How can I concatenate several text files into a single file?"
- Previous message: Kerem Gümrükcü: "Re: Protecting Assembly against disassembling..."
- In reply to: Q=A9=BCz?=: "Does anyone know how to split a string..."
- Next in thread: Q=A9=BCz?=: "Re: Does anyone know how to split a string..."
- Reply: Q=A9=BCz?=: "Re: Does anyone know how to split a string..."
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Mar 2005 22:23:03 +0700
A simple regex will do:
string input = "ABC001";
Regex regex = new Regex(@"(\d+)");
MatchCollection matches = regex.Matches(input);
int number = Int32.Parse(matches[0].Value);
number++;
string output = regex.Replace(input, number.ToString("000"));
HTH,
Alexander Shirshov
using System.Text.RegularE
"¶©¼z" <a@a.com> wrote in message news:42306001.2CA17A7A@a.com...
> hello, everybody
> i would like to know how to
> split a string which composed of (characters,digits)
> E.g. the string is ABC001, i would like split the "ABC" char and
> digits +1 to 002 then combine it to ABC002
>
> THX
- Next message: X-Killer: "Re: How can I concatenate several text files into a single file?"
- Previous message: Kerem Gümrükcü: "Re: Protecting Assembly against disassembling..."
- In reply to: Q=A9=BCz?=: "Does anyone know how to split a string..."
- Next in thread: Q=A9=BCz?=: "Re: Does anyone know how to split a string..."
- Reply: Q=A9=BCz?=: "Re: Does anyone know how to split a string..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|