String - RemoveNumber
A string extension method that removes the number described by string object.
public static void Main() { string input = "Entity Framework 6"; //C# Extension Method: String - RemoveNumber string output = input.RemoveNumber(); System.Console.WriteLine(output); }
View Source
using System; using System.Linq; public static partial class Extensions { /// <summary> /// A string extension method that removes the number described by @this. /// </summary> /// <param name="this">The @this to act on.</param> /// <returns>A string.</returns> public static string RemoveNumber(this string @this) { return new string(@this.ToCharArray().Where(x => !Char.IsNumber(x)).ToArray()); } }