Package sc.fiji.snt.gui
Class GuiUtils.Text
java.lang.Object
sc.fiji.snt.gui.GuiUtils.Text
- Enclosing class:
GuiUtils
Utility methods for wrapping, truncating, escaping, and lightly formatting plain/HTML text.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsNumber(String text) static booleancontainsSeparator(String text) static StringescapeHtml(String text) Escapes the handful of characters that are meaningful to an HTML parser.static Stringstatic StringmarkdownToHtml(String text) Converts a minimal, deliberately limited subset of Markdown (bold:**text**or__text__; italic:*text*or_text_) into HTML.static intrenderedWidth(String text) static StringConverts an action-name string to Title Case.static String
-
Constructor Details
-
Text
public Text()
-
-
Method Details
-
toTitleCase
Converts an action-name string to Title Case. -
renderedWidth
-
escapeHtml
Escapes the handful of characters that are meaningful to an HTML parser. Use before placing plain text inside HTML markup, so that a stray '<'/'&' in it is displayed literally instead of being misread as markup (an unescaped '<' in particular would otherwise be parsed as the start of a tag and swallow the rest of the text)- Parameters:
text- the plain text to escape
-
markdownToHtml
Converts a minimal, deliberately limited subset of Markdown (bold:**text**or__text__; italic:*text*or_text_) into HTML. The input is first run throughescapeHtml(String), so a literal '<', '>', or '&' intextis preserved as-is rather than read as markup, and only the recognized emphasis markers are turned into<b>/<i>tags; everything else is left as plain (now HTML-safe) text.- Parameters:
text- the plain text, optionally containing basic Markdown emphasis markers- Returns:
- HTML-escaped text with recognized Markdown emphasis converted to
<b>/<i>tags
-
truncate
-
containsNumber
-
containsSeparator
-
getClipboard
-