TextParser ClassDelta Engine Documentation
Breaks a string into a list of lines each of which is a list of characters. Also converts tabs to spaces and converts unsupported characters to question marks. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Rendering2D.Fonts TextParser

Namespace: DeltaEngine.Rendering2D.Fonts
Assembly: DeltaEngine.Rendering2D.Fonts (in DeltaEngine.Rendering2D.Fonts.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class TextParser

The TextParser type exposes the following members.

Constructors

  NameDescription
Public methodTextParser
Initializes a new instance of the TextParser class
Top
Methods

  NameDescription
Public methodGetLines
Top
Remarks

Tests: DeltaEngine.Rendering2D.Fonts.Tests.TextParserTests
Examples

5 unit tests call DeltaEngine.Rendering2D.Fonts.TextParser
[Test]
public void ParseEmptyText()
{
    var lines = parser.GetLines(GetSpaces(0));
    Assert.AreEqual(0, lines.Count);
}
[Test]
public void ParseSingleTextLine()
{
    var lines = parser.GetLines(GetSpaces(3));
    Assert.AreEqual(1, lines.Count);
    Assert.AreEqual(GetSpaces(3), new string(lines[0].ToArray()));
}
[Test]
public void ParseMultipleTextLines()
{
    var lines = parser.GetLines(GetSpaces(1) + Environment.NewLine + GetSpaces(2));
    Assert.AreEqual(2, lines.Count);
    Assert.AreEqual(GetSpaces(1), new string(lines[0].ToArray()));
    Assert.AreEqual(GetSpaces(2), new string(lines[1].ToArray()));
}
See Also