String - RemoveLetter

A string extension method that removes the letter described by string object.

Try it

public static void Main()
{	
    string input = "192.168.1.1a";

    //C# Extension Method: String - RemoveLetter
    string output = input.RemoveLetter();

    System.Console.WriteLine(output);

}

View Source
using System;
using System.Linq;

public static partial class Extensions
{
    /// <summary>
    ///     A string extension method that removes the letter described by @this.
    /// </summary>
    /// <param name="this">The @this to act on.</param>
    /// <returns>A string.</returns>
    public static string RemoveLetter(this string @this)
    {
        return new string(@this.ToCharArray().Where(x => !Char.IsLetter(x)).ToArray());
    }
}