util: Add removeFormattingTags text function

This commit is contained in:
Broooklyn
2020-06-04 22:27:51 -07:00
committed by Adam
parent 48e62c66ae
commit 3379494a67
3 changed files with 43 additions and 28 deletions

View File

@@ -39,7 +39,21 @@ public class TextTest
assertEquals("Not so much.", Text.removeTags("<col=FFFFFF This is a very special message.</col>Not so much."));
assertEquals("Use Item -> Man", Text.removeTags("Use Item -> Man"));
assertEquals("a < b", Text.removeTags("a < b"));
assertEquals("a b", Text.removeTags("a <lt> b"));
assertEquals("Remove no tags", Text.removeTags("Remove no tags"));
}
@Test
public void removeFormattingTags()
{
assertEquals("Test", Text.removeFormattingTags("<col=FFFFFF>Test</col>"));
assertEquals("Test", Text.removeFormattingTags("<img=1><s>Test</s>"));
assertEquals("Zezima (level-126)", Text.removeFormattingTags("<col=ffffff><img=2>Zezima<col=00ffff> (level-126)"));
assertEquals("", Text.removeFormattingTags("<colrandomtext test>"));
assertEquals("Not so much.", Text.removeFormattingTags("<col=FFFFFF This is a very special message.</col>Not so much."));
assertEquals("Use Item -> Man", Text.removeFormattingTags("Use Item -> Man"));
assertEquals("a < b", Text.removeFormattingTags("a < b"));
assertEquals("a <lt> b", Text.removeFormattingTags("a <lt> b"));
assertEquals("Remove no tags", Text.removeFormattingTags("Remove no tags"));
}
}