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


C# StringBuilder.Substring方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            StringBuilder t = new StringBuilder("Axl Rose has an IQ above the avarage.");
            StringBuilder firstPart = t.Substring(0, 12);
            StringBuilder secondPart = t.Substring(32, 5);

            Console.WriteLine(firstPart.ToString() + " " + secondPart.ToString());
        }
开发者ID:androidejl,项目名称:Telerik,代码行数:8,代码来源:Program.cs

示例2: Main

        public static void Main()
        {
            StringBuilder sb = new StringBuilder("1234");

            Console.WriteLine(sb.Substring(0));

            Console.WriteLine(sb.Substring(0, 4));

            Console.WriteLine(sb.Substring(3, 1));

            Console.WriteLine(sb.Substring(3));
        }
开发者ID:antonpopov,项目名称:Object-Oriented-Programming,代码行数:12,代码来源:SubstringTest.cs

示例3: Main

 static void Main()
 {
     // Testing the substring class in StringBuilder:
     StringBuilder testing = new StringBuilder();
     testing.Append("GugenheimAgugu");
     Console.WriteLine(testing.Substring(9, 5).ToString());
 }
开发者ID:Jarolim,项目名称:HomeWork,代码行数:7,代码来源:SubstringProgram.cs

示例4: Main

 static void Main()
 {
     StringBuilder sb = new StringBuilder("Only THIS will remain after the substring.");
     Console.WriteLine(sb);
     sb = sb.Substring(5, 4);
     Console.WriteLine(sb);
 }
开发者ID:jerko0,项目名称:Telerik-Academy,代码行数:7,代码来源:SubstringMain.cs

示例5: Main

        static void Main()
        {
            var text = new StringBuilder();
            text.Append("I am learning C sharp.");

            var subText = text.Substring(5, 8);

            Console.WriteLine(subText);
        }
开发者ID:SimoPrG,项目名称:TelerikAcademyHomeworks,代码行数:9,代码来源:StrBuilderSubStr.cs

示例6: Main

        static void Main()
        {
            Console.WriteLine("Enter a string: ");
            string input = Console.ReadLine();
            StringBuilder text = new StringBuilder(input);

            Console.WriteLine("StringBuilder.Substring: {0}", text.Substring(1, 5));
            Console.WriteLine("String.Substring:        {0}", input.Substring(1, 5));
        }
开发者ID:radenkovn,项目名称:Telerik-Homework,代码行数:9,代码来源:StrBuilderExt.cs

示例7: Main

        static void Main()
        {
            StringBuilder test = new StringBuilder("Hello Extension Methods");

            StringBuilder substring1 = test.Substring(3, 5);
            StringBuilder substring2 = StringBuilderSubstring.Substring(test, 3, 5);

            Console.WriteLine("Results should be the same =>\nsubstring1: {0}\nsubstring2: {1}", substring1, substring2);
        }
开发者ID:Moiraines,项目名称:TelerikAcademy,代码行数:9,代码来源:StringBuilderSubstringMain.cs

示例8: Main

 static void Main()
 {
     StringBuilder testExt = new StringBuilder();
     testExt.Append("test1");
     testExt.Append("test2");
     testExt.Append("test3");
        StringBuilder rezult = testExt.Substring(5, 5);
        Console.WriteLine(rezult);
 }
开发者ID:iliantova,项目名称:Telerik-Homework,代码行数:9,代码来源:SubstringExtensionMain.cs

示例9: Main

        static void Main()
        {
            string str = "Test of extention.";

            StringBuilder sb = new StringBuilder(str);

            sb = sb.Substring(1, 10);

            Console.WriteLine(sb);
        }
开发者ID:mdraganov,项目名称:Telerik-Academy,代码行数:10,代码来源:SubstringExtention.cs

示例10: Main

 public static void Main()
 {
     StringBuilder sb = new StringBuilder();
     Console.WriteLine("Enter string:");
     string input = Console.ReadLine();
     Console.WriteLine("Enter index:");
     int index = int.Parse(Console.ReadLine());
     Console.WriteLine("Enter length:");
     int length = int.Parse(Console.ReadLine());
     sb.Append(input);
     StringBuilder subStr = sb.Substring(index, length);
     Console.WriteLine(subStr.ToString());
 }
开发者ID:emilti,项目名称:Telerik-Academy-My-Courses,代码行数:13,代码来源:TestStringBuilder.cs

示例11: Main

        static void Main()
        {
            string test = "abvgde";

            Console.WriteLine( test.Substring(3, 3));

            Console.WriteLine();

            StringBuilder builder = new StringBuilder();
            builder.Append("a");
            builder.Append("b");
            builder.Append("v");
            builder.Append("g");
            builder.Append("de");
              //  builder.Append("e");

            Console.WriteLine(builder.Substring(3, 3));
        }
开发者ID:ztodorova,项目名称:Telerik-Academy,代码行数:18,代码来源:StringBuilderSubstringMain.cs


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