本文整理汇总了C#中Rope.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Rope.ToString方法的具体用法?C# Rope.ToString怎么用?C# Rope.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rope
的用法示例。
在下文中一共展示了Rope.ToString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendLongTextToEmptyRope
public void AppendLongTextToEmptyRope()
{
string text = BuildLongString(1000);
Rope<char> rope = new Rope<char>();
rope.AddText(text);
Assert.AreEqual(text, rope.ToString());
}
示例2: InitializeRopeFromLongString
public void InitializeRopeFromLongString()
{
string text = BuildLongString(1000);
Rope<char> rope = new Rope<char>(text);
Assert.AreEqual(text.Length, rope.Length);
Assert.AreEqual(text, rope.ToString());
Assert.AreEqual(text.ToCharArray(), rope.ToArray());
}
示例3: ConcatenateSmallRopesToRope
public void ConcatenateSmallRopesToRope()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 1000; i++) {
b.Append(i.ToString());
b.Append(' ');
rope.AddRange(CharRope.Create(i.ToString() + " "));
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
示例4: ConcatenateStringToRope
public void ConcatenateStringToRope()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 1000; i++) {
b.Append(i.ToString());
rope.AddText(i.ToString());
b.Append(' ');
rope.Add(' ');
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
示例5: ConcatenateSmallRopesToRopeBackwards
public void ConcatenateSmallRopesToRopeBackwards()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 1000; i++) {
b.Append(i.ToString());
b.Append(' ');
}
for (int i = 1000; i >= 1; i--) {
rope.InsertRange(0, CharRope.Create(i.ToString() + " "));
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
示例6: TestToArrayAndToStringWithParts
public void TestToArrayAndToStringWithParts()
{
string text = BuildLongString(1000);
Rope<char> rope = new Rope<char>(text);
string textPart = text.Substring(1200, 600);
char[] arrayPart = textPart.ToCharArray();
Assert.AreEqual(textPart, rope.ToString(1200, 600));
Assert.AreEqual(arrayPart, rope.ToArray(1200, 600));
Rope<char> partialRope = rope.GetRange(1200, 600);
Assert.AreEqual(textPart, partialRope.ToString());
Assert.AreEqual(arrayPart, partialRope.ToArray());
}
示例7: ConcatenateSmallRopesByInsertionInMiddle
public void ConcatenateSmallRopesByInsertionInMiddle()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 1000; i++) {
b.Append(i.ToString("d3"));
b.Append(' ');
}
int middle = 0;
for (int i = 1; i <= 500; i++) {
rope.InsertRange(middle, CharRope.Create(i.ToString("d3") + " "));
middle += 4;
rope.InsertRange(middle, CharRope.Create((1001-i).ToString("d3") + " "));
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
示例8: InitializeRopeFromShortString
public void InitializeRopeFromShortString()
{
Rope<char> rope = new Rope<char>("Hello, World");
Assert.AreEqual(12, rope.Length);
Assert.AreEqual("Hello, World", rope.ToString());
}
示例9: EmptyRopeFromString
public void EmptyRopeFromString()
{
Rope<char> empty = new Rope<char>(string.Empty);
Assert.AreEqual(0, empty.Length);
Assert.AreEqual("", empty.ToString());
}
示例10: ConcatenateStringToRopeByInsertionInMiddle
public void ConcatenateStringToRopeByInsertionInMiddle()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 998; i++) {
b.Append(i.ToString("d3"));
b.Append(' ');
}
int middle = 0;
for (int i = 1; i <= 499; i++) {
rope.InsertText(middle, i.ToString("d3"));
middle += 3;
rope.Insert(middle, ' ');
middle++;
rope.InsertText(middle, (999-i).ToString("d3"));
rope.Insert(middle + 3, ' ');
}
Assert.AreEqual(b.ToString(), rope.ToString());
}
示例11: ConcatenateStringToRopeBackwards
public void ConcatenateStringToRopeBackwards()
{
StringBuilder b = new StringBuilder();
Rope<char> rope = new Rope<char>();
for (int i = 1; i <= 1000; i++) {
b.Append(i.ToString());
b.Append(' ');
}
for (int i = 1000; i >= 1; i--) {
rope.Insert(0, ' ');
rope.InsertText(0, i.ToString());
}
Assert.AreEqual(b.ToString(), rope.ToString());
}