本文整理汇总了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);
}
示例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));
}
示例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));
}
示例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);
}
示例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"}));
}
示例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);
}
示例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);
}
示例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"));
}
示例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);
}
示例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"));
}
示例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));
}
示例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"));
}
示例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);
}
示例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);
}
示例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
}