I have a requirement to find and extract a number contained within a string.
For example, from these strings:
string test = \"1 test\" string test1 =
go through the string and use Char.IsDigit
Char.IsDigit
string a = "str123"; string b = string.Empty; int val; for (int i=0; i< a.Length; i++) { if (Char.IsDigit(a[i])) b += a[i]; } if (b.Length>0) val = int.Parse(b);