Exemple #1
0
        public override void Start()
        {
            Logger.Start("数组字符串");


            ArrayString a = new ArrayString("hello,Py,world", ',');

            a.Add("ok");
            a.RemoveAt(0);

            Logger.Write("hello,Py,world  + ok  ->   {0}", a.ToString());

            a[2] = "1";

            Logger.Write("设置a[2]后 , 字符串为     {0}", a.ToString());
        }
Exemple #2
0
        public override void Start()
        {
            const string T = "用于调试字符串,字符串。";

            Logger.Info("子字符串");

            Logger.Write(Str.Remove(T, 2, 1));
            Logger.Write(Str.RemoveEnd(T, 2));
            Logger.Write(Str.RemoveStart(T, 2));
            Logger.Write(Str.RemoveBefore(T, '调'));
            Logger.Write(Str.RemoveAfter(T, '调'));

            Logger.Write(Str.Substring(T, 1));
            Logger.Write(Str.TrimToLength(T, 3, "..."));

            string T3 = "aa-asd-aa";

            Logger.Info("长度不变的处理");

            Logger.Write(T3 = Str.Capitalize(T3));
            Logger.Write(Str.UnCapitalize(T3));
            Logger.Write(T3 = Str.ToCamel(T3));
            Logger.Write(T3 = Str.ToPascal(T3));
            Logger.Write(T3 = Str.Hyphenate(T3));
            Logger.Write(Str.ToLength(T3, 10));
            Logger.Write(Str.ToLength(T3, 8));

            Logger.Info("字符性质");

            Logger.Write(Str.CLength(T));
            Logger.Write(Str.Count(T, '用'));
            Logger.Write(Str.Count("aaabbbaaaa", "aa"));

            Logger.Info("编码");

            Logger.Write(int.Parse("12fe", System.Globalization.NumberStyles.HexNumber));


            Logger.Write(Str.HtmlEncode("<br>sdasd<div>sdasd</div>"));

            Logger.Write(Str.HtmlToString("<br>sdasd<div>sdasd</div>"));

            Logger.Write(Str.HtmlNoScript("<script>ddd</script><div onclick='alert()' style='height:expression(alert());font-size:2' sa='ggg'></div>"));

            Logger.Write(Str.UnicodeDecode(Str.UnicodeEncode("不飞asdaa?=s", "%u"), "%u"));
            Logger.Write(Str.UrlEncode("不飞asdaa?=s"));
            Logger.Write(Str.Unescape(Str.Escape("不飞asdaa?=s ")));


            ArrayString s = new ArrayString("ss,ss,dasd,asd", ',');

            s.Add("asfdsf");
            s.RemoveAt(0);
            Logger.Write(s.Count);

            Logger.Write(s.Length);

            Logger.Write(s.ToString());
        }