Archive for the ‘C#’ Category

How to find a number in a string

This few lines will let you find a number in astring.

Regex re = new Regex(@”\d+”);
Match m = re.Match(txtFindNumber.Text);
if (m.Success)
{
lblResults.Text = string.Format(”RegEx found ” + m.Value + ” at position ” + m.Index.ToString());
}
else
{
lblResults.Text = “You [...]

Read the rest of this entry »