String In Csharp

 

Saturday, May 30, 2009

Extract Numbers From String

private string ExtractNumbers(string Expression)
{
string result = null;
char Letter;

for (int i = 0; i < Expression.Length; i++)
{
Letter = Convert.ToChar(Expression.Substring(i, 1));

if (Char.IsNumber(Letter))
{
result += Letter.ToString();
}
}

// MessageBox.Show(result);
return result;
}

1 comment:

  1. Dear Sir,

    I hope you are doing well. I got this email address from one of your contribution web site. I have launched a web site www.codegain.com and it is basically aimed C#,JAVA,VB.NET,ASP.NET,AJAX,Sql Server,Oracle,WPF,WCF and etc resources, programming help, articles, code snippet, video demonstrations and problems solving support. I would like to invite you as an author and a supporter.
    Looking forward to hearing from you and hope you will join with us soon.

    Thank you
    RRaveen
    Founder CodeGain.com

    ReplyDelete

All Menu