Lars Holm Jensen's Code Blog

Just another WordPress codeblog on C#, Silverlight and all things .NET

Archive for the ‘digits’ tag

C# string to alphanumeric

with one comment

Short and easy way to get the alphanumeric content of a string:

public static string ToAlphaNumeric(this string str)
{
    return new string(str.Where(c => char.IsLetterOrDigit(c)).ToArray());
}

Written by larsholm

June 16th, 2011 at 9:32 pm

Posted in .NET

Tagged with , , , ,