private string GetTag(Substring theInput) { StringBuilder tag = new StringBuilder(); int i = 0; if (theInput[0] == '/') tag.Append(theInput[i++]); while (i < theInput.Length && char.IsLetter(theInput[i])) { tag.Append(theInput[i++]); } return tag.ToString().ToLower(); }
private static bool IsValidTag(Substring theBody) { return theBody[0] == '/' || char.IsLetter(theBody[0]); }
public void Append(Substring theInput) { for (int i = 0; i < theInput.Length; i++) { char input = theInput[i]; if (FitVersionFixture.IsStandard && input != '\u00a0' && char.IsWhiteSpace(input)) { if (!myWhitespace) { myText.Append(' '); myLastTag = myLastTag + " "; } myWhitespace = true; } else { switch (input) { case '\u201c': input = '"'; break; case '\u201d': input = '"'; break; case '\u2018': input = '\''; break; case '\u2019': input = '\''; break; case '\u00a0': input = ' '; break; case '&': if (theInput.Contains(i + 1, "nbsp;")) { input = ' '; i += 5; } break; } myText.Append(input); myWhitespace = false; myLastTag = string.Empty; } } }