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


C# StringBuilder.SubString方法代码示例

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


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

示例1: Main

 static void Main()
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("The special love I have for you! My baby blue");
     Console.WriteLine(builder.SubString(12, 4));
     Console.WriteLine(builder.SubString(33));
 }
开发者ID:nzhul,项目名称:TelerikAcademy,代码行数:7,代码来源:SubstringSBTest.cs

示例2: Main

        static void Main()
        {
            StringBuilder theString = new StringBuilder();
            theString.Append("0123456789");

            Console.WriteLine(theString.SubString(5));
            Console.WriteLine(theString.SubString(2, 5));
        }
开发者ID:BorislavIvanov,项目名称:Telerik_Academy,代码行数:8,代码来源:SubstringTest.cs

示例3: Main

 static void Main()
 {
     // Test the extension method
     StringBuilder testSb = new StringBuilder();
     testSb.Append("Pesho and Gosho are the best of friends!");
     Console.WriteLine(testSb.SubString(10, 5)); // Gosho
     Console.WriteLine(testSb.SubString(0, 5)); // Pesho
 }
开发者ID:hrist0stoichev,项目名称:Telerik-Homeworks,代码行数:8,代码来源:ExtensionTest.cs

示例4: Main

        private static void Main()
        {
            StringBuilder someStringBuilder = new StringBuilder("Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string.");

            //// index
            Console.WriteLine(someStringBuilder.SubString(42));
            //// index ,length
            Console.WriteLine(someStringBuilder.SubString(0, 41));
        }
开发者ID:rusekov,项目名称:HomeWorksOOP,代码行数:9,代码来源:ExtensionMain.cs

示例5: Main

 static void Main()
 {
     string str = "asdAsd";
     Console.WriteLine(str.Substring(1));
     Console.WriteLine(str.Substring(1,3));
     StringBuilder sb = new StringBuilder("asdasd");
     Console.WriteLine(sb.SubString(3,3));
     Console.WriteLine( sb.SubString(0, 3));
 }
开发者ID:vstoyanov88,项目名称:TelerikAcademy,代码行数:9,代码来源:Program.cs

示例6: Main

        static void Main(string[] args)
        {
            string s = "MickiMouseManagement";

            StringBuilder sb = new StringBuilder(s);

            Console.WriteLine(sb.SubString(0, 5).ToString());

            Console.WriteLine(sb.SubString(5, 5).ToString());

            Console.WriteLine(sb.SubString(10, 10).ToString());
        }
开发者ID:psabinski,项目名称:Principles-Of-OOP,代码行数:12,代码来源:SubstringExt.cs

示例7: Main

 // Implement an extension method Substring(int index, int length) for the class StringBuilder
 // that returns new StringBuilder and has the same functionality as Substring in the class String.
 static void Main()
 {
     string text = "Pesho";
     Console.WriteLine(text.Substring(1, 3));// testing substring of string
     Console.WriteLine(text.Substring(2));
     StringBuilder sb = new StringBuilder();
     sb.Append("Gosho");
     sb.Append("Milena");
     Console.WriteLine(sb.SubString(1,2).ToString());
     Console.WriteLine(sb.SubString(1, 9).ToString());//testing substring of StringBuilder
     Console.WriteLine(sb.Substring(3));
 }
开发者ID:zivoroka,项目名称:TelerikAcademy,代码行数:14,代码来源:StringBuilderSubstringMain.cs

示例8: Main

 static void Main()
 {
     StringBuilder test = new StringBuilder();
     test.AppendLine("This is testing string");
     string result = test.SubString(2, 3).ToString();
     Console.WriteLine(result);
 }
开发者ID:pecsi1009,项目名称:CSarp,代码行数:7,代码来源:StringBuilderSub.cs

示例9: Main

        static void Main(string[] args)
        {
            string someText = "alabalanica";
            StringBuilder someString = new StringBuilder(someText);

            Console.WriteLine(someString.SubString(1,7).ToString());
        }
开发者ID:kikooo52,项目名称:C-Programs,代码行数:7,代码来源:Program.cs

示例10: Main

   static void Main(string[] args)
   {
       StringBuilder test = new StringBuilder();
       test.Append("ABCDIFGH");
       Console.WriteLine(test.SubString(5, 2).ToString());
 
   }
开发者ID:Jarolim,项目名称:AllMyHomeworkForTelerikAcademy,代码行数:7,代码来源:Program.cs

示例11: Main

 //Implement an extension method Substring(int index, int length) for the class StringBuilder that returns new StringBuilder
 //and has the same functionality as Substring in the class String.
 static void Main(string[] args)
 {
     StringBuilder testing = new StringBuilder();
     testing.AppendLine("Some text"); // the bellow values are hardcoded for the examplary function of the task
     Console.WriteLine(testing.SubString(2, 2).ToString());   //takes an index and from it with the specified length returns
                                                             //a stringBuilder value of the one that was passed
 }
开发者ID:sbaychev,项目名称:TelerikAcademy,代码行数:9,代码来源:Program.cs

示例12: Main

        public static void Main()
        {
            var builder = new StringBuilder("StringBuilder in the house!");

            var subBuilder = builder.SubString(0, 13);

            Console.WriteLine(subBuilder);
        }
开发者ID:NikolaiMishev,项目名称:Telerik-Academy,代码行数:8,代码来源:Test.cs

示例13: Main

 static void Main(string[] args)
 {
     StringBuilder str = new StringBuilder();
     str.Append("Abra cadabra sin salabim");
     int index = 1;
     int lenght = 7;
     Console.WriteLine(str.SubString(index,lenght).ToString());
     
 }
开发者ID:bahtev,项目名称:TelerikAcademy,代码行数:9,代码来源:01.SubstringToStringBuilder.cs

示例14: Main

 static void Main()
 {
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < 10; i++)
     {
         sb.Append("Some text ");
     }
     string str = sb.SubString(1, 7);
     Console.WriteLine(str);
 }
开发者ID:VDGone,项目名称:TelerikAcademy-1,代码行数:10,代码来源:StringBuilderSubstring.cs

示例15: Main

        static void Main(string[] args)
        {
            //Testing
            StringBuilder test = new StringBuilder();
            StringBuilder result = new StringBuilder();
            string sampleText = "Test me please.";

            test.Append(sampleText);
            result = test.SubString(14,0);
            Console.WriteLine(result);
   
        }
开发者ID:vaster,项目名称:Telerik.vasko,代码行数:12,代码来源:Core.cs


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