当前位置: 首页>>代码示例>>C#>>正文


C# StringBuilder.AppendAll方法代码示例

本文整理汇总了C#中StringBuilder.AppendAll方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.AppendAll方法的具体用法?C# StringBuilder.AppendAll怎么用?C# StringBuilder.AppendAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringBuilder的用法示例。


在下文中一共展示了StringBuilder.AppendAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        public static void Main(string[] args)
        {
            StringBuilder strb = new StringBuilder("I really like my name: Ginka, GINKA, GiNkA, gInKa, GInka, GINka");

            var substr = strb.Substring(2, 15);
            Console.WriteLine(substr);

            strb.RemoveText("ginka");
            Console.WriteLine(strb.ToString());

            var numbers = new List<double> { 2.34, 3.456, 0.2345 };
            var words = new List<string> { "abra", "kadabra" };
            strb.AppendAll(numbers);
            Console.WriteLine(strb);
            strb.AppendAll(words);
            Console.WriteLine(strb);
        }
开发者ID:ScreeM92,项目名称:Software-University,代码行数:17,代码来源:ExtensionsDemo.cs

示例2: Main

 public static void Main()
 {
     StringBuilder str = new StringBuilder();
     str.Append("Test extension methods for the class StringBuilder.");
     Console.WriteLine(str.Substring(5, 17));
     Console.WriteLine(str.RemoveText("methods"));
     IEnumerable<int> numbers = new List<int>() { 1, 2, 3, 4, 5 };
     Console.WriteLine(str.AppendAll<int>(numbers));
 }
开发者ID:GeorgiLambov,项目名称:SoftwareUniversity,代码行数:9,代码来源:StringBuilderExtension.cs

示例3: Main

        static void Main()
        {
            StringBuilder text = new StringBuilder("Example text.");
            IEnumerable<int> list = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            Console.WriteLine(text.Substring(1, 3));
            Console.WriteLine(text.RemoveText("exa"));
            Console.WriteLine(text.AppendAll<int>(list));
        }
开发者ID:BAleksiev,项目名称:OOP-Course,代码行数:9,代码来源:Program.cs

示例4: Main

        public static void Main()
        {
            StringBuilder test = new StringBuilder("toMAtoes aRe cOol");
            Console.WriteLine(test.Substring(2, 4));

            test.RemoveText(" ArE");
            Console.WriteLine(test);

            test.Clear();
            string[] words = { "pesho", "gosho", "vanko", "kiro", "jojo" };
            test.AppendAll(words);
            Console.WriteLine(test);

            List<int> nums = new List<int>() { 1, 3, 15, 24, 99 };
            test.Append(" ");
            test.AppendAll(nums);
            Console.WriteLine(test);
        }
开发者ID:reminchev,项目名称:SoftUni-Projects,代码行数:18,代码来源:Tests.cs

示例5: Main

    static void Main()
    {
        var str = new StringBuilder("Functional Programming");
        Console.WriteLine(str.Substring(0, 11));

        str = new StringBuilder("Functional funcTional Programming");
        Console.WriteLine(str.RemoveText("Functional"));
        Console.WriteLine(str.AppendAll(new string[]{" ", "one", " ", "two"}));
    }
开发者ID:TzvetanIG,项目名称:OOP,代码行数:9,代码来源:TestStringBuilder.cs

示例6: Main

        static void Main(string[] args)
        {
            StringBuilder tmp = new StringBuilder("Pesho, Kiro, kiro, Stamat");

            int[] nums = new int[5]{1, 2, 3, 4, 5};
            List<string> names = new List<string> { "Evgeni", "Lora", "Bai Ivan" };

            String subStr = tmp.SubString(7, 4);
            Console.WriteLine(subStr);
            Console.WriteLine();

            Console.WriteLine(tmp.RemoveText(" kiro,"));
            Console.WriteLine();

            tmp.AppendAll<int>(nums);
            tmp.AppendAll<string>(names);
            Console.WriteLine(tmp);
        }
开发者ID:ImarKelam,项目名称:OOP,代码行数:18,代码来源:Program.cs

示例7: Main

 static void Main(string[] args)
 {
     StringBuilder s = new StringBuilder();
     s.Append("kaji babe \"thank u.\"");
     Console.WriteLine(string.Format("Text: \n{0}",s));
     Console.WriteLine("Substring with parameters [1,6]: \n"+s.Substr(1, 6));
     Console.WriteLine("Remove text'babe':\n"+s.RemoveText("babe"));
     s.AppendAll(new List<string>{" Mai " , "uakahme ", "neshatata ", "Pesho!"});
     Console.WriteLine(s);
 }
开发者ID:yavor2000,项目名称:All-HomeWorks-SoftwareUniversity-TelerikAcademy,代码行数:10,代码来源:Program.cs

示例8: Main

        public static void Main()
        {
            var text = new StringBuilder("I'm the grates Cezar of all times!");
            Console.WriteLine("Original phraze: {0}\n", text);

            Console.WriteLine("(Substring) - Name: {0}", text.Substring(15, 5));
            var list = new List<string>() { " As ", "we ", "all ", "are!" };
            Console.WriteLine("(AppendAll) - Some new words: {0}", text.AppendAll(list));
            Console.WriteLine("(RemoveText) - Remove name: {0}", text.RemoveText("Cezar"));
        }
开发者ID:tormibg,项目名称:SoftUni-1,代码行数:10,代码来源:StringBuilderExtensionsTest.cs

示例9: AppendAll_ES_Empty_Results

        public void AppendAll_ES_Empty_Results()
        {
            var b = new StringBuilder();
            var nl = Environment.NewLine;

            var items = new List<string> { "", "", "", "" };
            var buf = b.AppendAll(items).ToString();

            Expect(buf.ToString(), Is.Empty);
        }
开发者ID:lcaballero,项目名称:LucidEdge,代码行数:10,代码来源:Test_Append_Lines.cs

示例10: AppendAll_ES_T

        public void AppendAll_ES_T()
        {
            var b = new StringBuilder();
            var items = new List<int> { 1, 2, 3, 4 };
            var dict = items.ToDictionary(n => n, n => n * 2);

            var s = b.AppendAll(dict, (buf, n) => buf.AppendFormat("{0}={1}", n.Key, n.Value));

            Expect(s.ToString(), Is.EqualTo("1=22=43=64=8"));
        }
开发者ID:lcaballero,项目名称:LucidEdge,代码行数:10,代码来源:Test_Append_Lines.cs

示例11: Main

        public static void Main()
        {
            var extensionTest = new StringBuilder("Compelling data. Big ideas. Creative juice. Put Google research and insight behind your thinking.");
            var list = new List<string>() { "a", "b", "c", "d" };

            Console.WriteLine(extensionTest.GetSubstring(2, 10));
            extensionTest.RemoveText("Big ideas");
            Console.WriteLine(extensionTest);
            Console.WriteLine(extensionTest.AppendAll(list));
        }
开发者ID:EmilAleksandrov,项目名称:OOP,代码行数:10,代码来源:Test.cs

示例12: AppendAll_ES_Embeded_Chars

        public void AppendAll_ES_Embeded_Chars()
        {
            var b = new StringBuilder();
            var nl = Environment.NewLine;

            var items = new List<string> { "1", "2", "3", "4" };
            var buf = b.AppendAll(items).ToString();

            Expect(buf.ToString(), Is.EqualTo("1234"));
        }
开发者ID:lcaballero,项目名称:LucidEdge,代码行数:10,代码来源:Test_Append_Lines.cs

示例13: Main

 static void Main()
 {
     StringBuilder text = new StringBuilder("SoftUni");
     Console.WriteLine(text.Substring(4, 3));
     text.RemoveText("Uni");
     Console.WriteLine(text);
     List<int> integers = new List<int>() { 1, 2, 4, 5 };
     text.AppendAll(integers);
     Console.WriteLine(text);
 }
开发者ID:shnogeorgiev,项目名称:Software-University-Courses,代码行数:10,代码来源:SubstringExtensionsDemo.cs

示例14: Main

 static void Main()
 {
     StringBuilder str = new StringBuilder("georgi ivanov");
     IEnumerable<object> chars = new List<string>() { "georgiev", "ivanov" };
     Console.WriteLine(str.AppendAll(chars));
     string substring = str.Substring(4, 9);
     str.RemoveText("georgi ");
     Console.WriteLine(str);
     Console.WriteLine(substring);
 }
开发者ID:zhanivanov,项目名称:OOP_September_Homeworks,代码行数:10,代码来源:TestExtensions.cs

示例15: Main

        public static void Main()
        {
            StringBuilder sb = new StringBuilder("Implement some extension methods for the class StringBuilder:");
            IEnumerable<int> numbers = new List<int>() { 1, 2, 3, 4, 5, 6 };

            Console.WriteLine(sb.Substring(8, 16));
            Console.WriteLine(sb.RemoveText("ion method"));
            Console.WriteLine(sb.AppendAll<int>(numbers));

            // Console.WriteLine(sb.AppendAll<long>(numbers)); //// compile time error
        }
开发者ID:ScreeM92,项目名称:Software-University,代码行数:11,代码来源:StringBuilderTest.cs


注:本文中的StringBuilder.AppendAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。