コード例 #1
0
        public void StringExtensionsTest()
        {
            bool   boolVal;
            string strVal;

            char[] charArray;
            ReadOnlyMemory <char> charRom;
            ReadOnlySpan <char>   charRos;

            boolVal   = StringExtensions.TryToBoolean(string.Empty, out boolVal);
            boolVal   = StringExtensions.ToBoolean("true");
            strVal    = StringExtensions.Abridge(string.Empty, 4);
            strVal    = StringExtensions.RemoveControlChars(string.Empty);
            strVal    = StringExtensions.RemoveControlChars(string.Empty, true);
            strVal    = StringExtensions.RemoveControlChars(string.Empty, ControlCharsReplaceMode.RemoveAll);
            strVal    = StringExtensions.RemoveControlChars(string.Empty, ControlCharsReplaceMode.RemoveAll, false);
            strVal    = StringExtensions.RemoveControlChars(string.Empty, ControlCharsReplaceMode.RemoveAll, false, true);
            strVal    = StringExtensions.RemoveControlChars(string.Empty, ControlCharsReplaceMode.RemoveAll, false, true, false);
            charArray = StringExtensions.RemoveControlChars(Array.Empty <char>(), ControlCharsReplaceMode.RemoveAll);
            charArray = StringExtensions.RemoveControlChars(Array.Empty <char>(), ControlCharsReplaceMode.RemoveAll, false);
            charArray = StringExtensions.RemoveControlChars(Array.Empty <char>(), ControlCharsReplaceMode.RemoveAll, false, true);
            charArray = StringExtensions.RemoveControlChars(Array.Empty <char>(), ControlCharsReplaceMode.RemoveAll, false, true, false);
            charRom   = StringExtensions.RemoveControlChars(new Memory <char>(), ControlCharsReplaceMode.RemoveAll);
            charRom   = StringExtensions.RemoveControlChars(new Memory <char>(), ControlCharsReplaceMode.RemoveAll, false);
            charRom   = StringExtensions.RemoveControlChars(new Memory <char>(), ControlCharsReplaceMode.RemoveAll, false, true);
            charRom   = StringExtensions.RemoveControlChars(new Memory <char>(), ControlCharsReplaceMode.RemoveAll, false, true, false);
            charRom   = StringExtensions.RemoveControlChars(new ReadOnlyMemory <char>(), ControlCharsReplaceMode.RemoveAll);
            charRom   = StringExtensions.RemoveControlChars(new ReadOnlyMemory <char>(), ControlCharsReplaceMode.RemoveAll, false);
            charRom   = StringExtensions.RemoveControlChars(new ReadOnlyMemory <char>(), ControlCharsReplaceMode.RemoveAll, false, true);
            charRom   = StringExtensions.RemoveControlChars(new ReadOnlyMemory <char>(), ControlCharsReplaceMode.RemoveAll, false, true, false);
            charRos   = StringExtensions.RemoveControlChars(new ReadOnlySpan <char>(), ControlCharsReplaceMode.RemoveAll);
            charRos   = StringExtensions.RemoveControlChars(new ReadOnlySpan <char>(), ControlCharsReplaceMode.RemoveAll, false);
            charRos   = StringExtensions.RemoveControlChars(new ReadOnlySpan <char>(), ControlCharsReplaceMode.RemoveAll, false, true);
            charRos   = StringExtensions.RemoveControlChars(new ReadOnlySpan <char>(), ControlCharsReplaceMode.RemoveAll, false, true, false);
            charRos   = StringExtensions.RemoveControlChars(new Span <char>(), ControlCharsReplaceMode.RemoveAll);
            charRos   = StringExtensions.RemoveControlChars(new Span <char>(), ControlCharsReplaceMode.RemoveAll, false);
            charRos   = StringExtensions.RemoveControlChars(new Span <char>(), ControlCharsReplaceMode.RemoveAll, false, true);
            charRos   = StringExtensions.RemoveControlChars(new Span <char>(), ControlCharsReplaceMode.RemoveAll, false, true, false);

            boolVal   = string.Empty.TryToBoolean(out boolVal);
            boolVal   = "true".ToBoolean();
            strVal    = string.Empty.Abridge(4);
            strVal    = string.Empty.RemoveControlChars();
            strVal    = string.Empty.RemoveControlChars(true);
            strVal    = string.Empty.RemoveControlChars(ControlCharsReplaceMode.RemoveAll);
            strVal    = string.Empty.RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false);
            strVal    = string.Empty.RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true);
            strVal    = string.Empty.RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true, false);
            charArray = Array.Empty <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll);
            charArray = Array.Empty <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false);
            charArray = Array.Empty <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true);
            charArray = Array.Empty <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true, false);
            charRom   = new Memory <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll);
            charRom   = new Memory <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false);
            charRom   = new Memory <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true);
            charRom   = new Memory <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true, false);
            charRom   = new ReadOnlyMemory <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll);
            charRom   = new ReadOnlyMemory <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false);
            charRom   = new ReadOnlyMemory <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true);
            charRom   = new ReadOnlyMemory <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true, false);
            charRos   = new ReadOnlySpan <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll);
            charRos   = new ReadOnlySpan <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false);
            charRos   = new ReadOnlySpan <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true);
            charRos   = new ReadOnlySpan <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true, false);
            charRos   = new Span <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll);
            charRos   = new Span <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false);
            charRos   = new Span <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true);
            charRos   = new Span <char>().RemoveControlChars(ControlCharsReplaceMode.RemoveAll, false, true, false);
        }