Sunday, September 29, 2013

Splitting number and string using linq

rrodri,


It seems that you wanna seperate characters from digits. So I think you can also try this method:



string s = "abcde1234";
string regExp="(?<One>[A-za-z]+)(?<Two>[0-9]+)";
Regex reg = new Regex(regExp);
foreach (Match item in reg.Matches(s))
{
Console.WriteLine(item.Groups["One"].Value); //abcde
Console.WriteLine(item.Groups["Two"].Value); //1234
}



Click For donating:Free Rice For the poor

For spamming-sender issues, you can either report it at Microsoft Spamming Issue , or just find "Report Spam Here+Number" at Forum Issue ;You can also find "Verify Your Account+Number" at "Forum Issue", where you can submit to be confirmed to paste links or images.

For more things to talk about? StackOverFlow is your choice.


No comments:

Post a Comment