Please visit DEMANDDRAFT.SHOP for quality of products...

Ad

Search This Blog

Sunday, June 10, 2012

Finding Number from the String


Protected void ChkNumFromString()
{
  Regex re = new Regex(@"\d+");
  Matchm = re.Match(txtNumbers.Text);
  if(m.Success)
  {
   lblResults.Text = string.Format("RegEx found " + m.Value + " at position " + m.Index.ToString());
  }
  else
  {
    lblResults.Text = "You didn't enter a string containing a number!";
  }
}

No comments:

Post a Comment