Remove all characters other than alphabets from string | C # program to remove all the characters other then alphabets ; function to remove characters and print new string ; Finding the character whose ASCII value fall under this range ; erase function to erase the character ; Driver code
using System ; class GFG { static void removeSpecialCharacter ( string s ) { for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] < ' A ' s [ i ] > ' Z ' && s [ i ] < ' a ' s [ i ] > ' z ' ) { s = s . Remove ( i , 1 ) ; i -- ; } } Console . Write ( s ) ; } public static void Main ( ) { string s = " $ Gee * k ; s . . fo , ▁ r ' Ge ^ eks ? " ; removeSpecialCharacter ( s ) ; } }