本文整理汇总了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));
}
示例2: Main
static void Main()
{
StringBuilder theString = new StringBuilder();
theString.Append("0123456789");
Console.WriteLine(theString.SubString(5));
Console.WriteLine(theString.SubString(2, 5));
}
示例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
}
示例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));
}
示例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));
}
示例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());
}
示例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));
}
示例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);
}
示例9: Main
static void Main(string[] args)
{
string someText = "alabalanica";
StringBuilder someString = new StringBuilder(someText);
Console.WriteLine(someString.SubString(1,7).ToString());
}
示例10: Main
static void Main(string[] args)
{
StringBuilder test = new StringBuilder();
test.Append("ABCDIFGH");
Console.WriteLine(test.SubString(5, 2).ToString());
}
示例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
}
示例12: Main
public static void Main()
{
var builder = new StringBuilder("StringBuilder in the house!");
var subBuilder = builder.SubString(0, 13);
Console.WriteLine(subBuilder);
}
示例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());
}
示例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);
}
示例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);
}