示例#1
0
文件: MyString.cs 项目: oxugen/labs
        public static MyString operator --(MyString s)
        {
            MyString ret = new MyString(s);

            ret.data = ret.data.Remove((ret.ToString().Length - 1), 1);
            return(ret);
        }
示例#2
0
        public static bool ServiceCheck(this MyString str)
        {
            HashSet <char> serviceSymbols = new HashSet <char>();

            serviceSymbols.Add('/');
            serviceSymbols.Add('\\');
            serviceSymbols.Add('"');
            serviceSymbols.Add('$');
            foreach (var i in str.ToString())
            {
                if (serviceSymbols.Contains(i))
                {
                    return(true);
                }
            }
            return(false);
        }
示例#3
0
        public static MyString DeletePunctuation(this MyString str)
        {
            MyString       temp           = new MyString(str);
            HashSet <char> serviceSymbols = new HashSet <char>();

            serviceSymbols.Add('.');
            serviceSymbols.Add(',');
            serviceSymbols.Add(':');
            serviceSymbols.Add('?');
            serviceSymbols.Add('!');
            serviceSymbols.Add('-');
            string tempString = str.ToString();

            for (int i = 0; i < tempString.Length; i++)
            {
                if (serviceSymbols.Contains(tempString[i]))
                {
                    tempString = tempString.Remove(i, 1);
                }
            }
            temp.SetString(tempString);
            return(temp);
        }
示例#4
0
 public static int Count(this MyString str)
 {
     return(str.ToString().Length);
 }