RE: string help
Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance
Hello,
you can achieve it using the Regular Expressions.
System.Text.RegularExpressions.Regex regEx = new
System.Text.RegularExpressions.Regex(@"[\d]+|[\D]+");
string str = "B1234";
System.Text.RegularExpressions.MatchCollection col =
regEx.Matches(str);
string string1 = str.Substring(col[0].Index,col[0].Length);
string string2 = str.Substring(col[1].Index,col[1].Length);
Console.WriteLine(string1);
Console.WriteLine(string2);
HTH :)
Maqsood Ahmed [MCP,C#]
Kolachi Advanced Technologies
http://www.kolachi.net
*** Sent via Developersdex
http://www.developersdex.com ***
.
Relevant Pages
- Re: Regular Expression Question. Please help!
... Try Regex (Regular expressions) ... Shivprasad Koirala ... Prev by Date: ... (microsoft.public.dotnet.languages.csharp) - Re: Generate all possible maches from a regular expression.
... > i have set of over 100+ regular expressions, ... > like if a regex is ... what is your mobile phone number ... Prev by Date: ... (microsoft.public.dotnet.languages.vb) - Re: Regular Expression - More learning
... Working out when to use regular expressions and when to use ... I'll have a look at the regex ... If replying to the group, please do not mail me too ... Prev by Date: ... (microsoft.public.dotnet.languages.csharp) - Re: Search for multiple things in a string
... >> I also feel that Regular Expressions, being an object in asp.net (not ... So using Regex is not really like using another language (as C# is different ... I agree with you that readability is important. ... And I was not saying experiment with it. ... (microsoft.public.dotnet.languages.csharp) - Re: for a laught (???)
... Regex doesn't work too well with a null byte delimiter :-) ... the API for a particular form of regular expressions ... Regex doesn't work with null terminated strings. ... qualifier or the qualifier "commonly" might have suggested. ... (comp.lang.cobol) |
|