C# 字串遇到關鍵字援就移除

摘要:C# 字串遇到關鍵字援就移除

    class Program
    {
        static void Main(string[] args)
        {
            string val = "This is beautiful world.";
            Console.WriteLine(val.RemoveAEIOU());
            Console.ReadLine();
        }
    }

    public static class ExtensionString
    {
        public static string RemoveAEIOU(this string s)
        {
            string[] ary = s.Split(new char[] {'A', 'a', 'E', 'e', 
                                            'I', 'i', 'O' ,'o', 
                                            'U', 'u'},
                                    StringSplitOptions.RemoveEmptyEntries);
            return string.Join("", ary);
        }
    }

資料來源: http://ithelp.ithome.com.tw/question/10099209