
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 0.46 KB | hits: 11 | expires: Never
read serial numbers with regex and place them as individual elements of a List<string>
string[] mySerialNumbers = searchString.Split(new char[]{' '});
List<string> mySerialNumbers = new List<string>(searchString.Split(new char[]{' '});
foreach(Match match in Regex.Matches("1108656 1108657 1108658 1108659", "[0-9]{5,8}"))
{
// Do something with match.Value here like : int.Parse(match.Value)
}
string[] SerialNum = Regex.Split("yourStringVar", " ")