TextUtils (Freeplane API 1.11.8)
Description: declaration: package: org.freeplane.core.util, class: TextUtils

Package org.freeplane.core.util

# Class TextUtils

java.lang.Object
org.freeplane.core.util.TextUtils

public class TextUtils extends Object
utilities for translations, conversions to/from number and dates etc. In scripts available as "global variable" `textUtils`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TextUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `capitalize(String string)`
  `static void`
  `copyHtmlToClipboard(String html)`
  Shortcut for scripting: Copies `html` with mimetype text/html to the system clipboard.
  `static void`
  `copyToClipboard(String string)`
  Shortcut for scripting: Copies `string` to the system clipboard.
  `static org.freeplane.core.resources.TranslatedObject`
  `createTranslatedString(String key)`
  `static void`
  `escapeUtf8(Writer out, String str)`
  Escapes the UTF-8 non-ASCII characters in a `String` to a `Writer`.
  `static String`
  `escapeUtf8(String str)`
  The escapeUtf8 method is a stripped down version of the StringEscapeUtils.escapeJava method in Commons Lang 2.6 It escapes the UTF-8 non-ASCII characters in a `String`.
  `static String`
  `format(String resourceKey, Object... messageArguments)`
  `SimpleDateFormat`
  `getDefaultDateFormat()`
  accessor for scripts.
  `SimpleDateFormat`
  `getDefaultDateTimeFormat()`
  accessor for scripts.
  `DecimalFormat`
  `getDefaultNumberFormat()`
  accessor for scripts.
  `static String`
  `getOptionalText(String string)`
  `static String`
  `getOptionalText(String string, String defaultValue)`
  `static String`
  `getOptionalTranslation(String text)`
  `static String`
  `getOriginalRawText(String key)`
  `static String`
  `getRawText(String key)`
  `static String`
  `getRawText(String key, String defaultString)`
  `static String`
  `getShortText(String text, int maximumCharacters, String continuationMark)`
  `static String`
  `getText(String key)`
  `static String`
  `getText(String key, String defaultString)`
  `static boolean`
  `isEmpty(String str)`
  `static boolean`
  `isNumber(String text)`
  `static boolean`
  `matchesUriPattern(String text)`
  in opposite to the URI make scheme mandatory.
  `static String`
  `removeMnemonic(String rawLabel)`
  `static String`
  `removeTranslateComment(String inputString)`
  Removes the "TranslateMe" sign from the end of not translated texts.
  `static String`
  `replaceAtBegin(String source, String from, String to)`
  `static Number`
  `toNumber(String text)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TextUtils

    public TextUtils()

- ## Method Details

  - ### format

    public static String format(String resourceKey, Object... messageArguments)

  - ### getOptionalText

    public static String getOptionalText(String string)

  - ### getOptionalText

    public static String getOptionalText(String string, String defaultValue)

  - ### removeMnemonic

    public static String removeMnemonic(String rawLabel)

  - ### removeTranslateComment

    public static String removeTranslateComment(String inputString)
    Removes the "TranslateMe" sign from the end of not translated texts.

  - ### createTranslatedString

    public static org.freeplane.core.resources.TranslatedObject createTranslatedString(String key)

  - ### getText

    public static String getText(String key)

  - ### getRawText

    public static String getRawText(String key)

  - ### getOriginalRawText

    public static String getOriginalRawText(String key)

  - ### getText

    public static String getText(String key, String defaultString)

  - ### getRawText

    public static String getRawText(String key, String defaultString)

  - ### getOptionalTranslation

    public static String getOptionalTranslation(String text)

  - ### toNumber

    public static Number toNumber(String text) throws NumberFormatException
    Throws:
      `NumberFormatException`

  - ### isNumber

    public static boolean isNumber(String text)

  - ### isEmpty

    public static boolean isEmpty(String str)

  - ### matchesUriPattern

    public static boolean matchesUriPattern(String text)
    in opposite to the URI make scheme mandatory.

  - ### getShortText

    public static String getShortText(String text, int maximumCharacters, String continuationMark)

  - ### getDefaultNumberFormat

    public DecimalFormat getDefaultNumberFormat()
    accessor for scripts.

  - ### getDefaultDateFormat

    public SimpleDateFormat getDefaultDateFormat()
    accessor for scripts.

  - ### getDefaultDateTimeFormat

    public SimpleDateFormat getDefaultDateTimeFormat()
    accessor for scripts.

  - ### capitalize

    public static String capitalize(String string)

  - ### replaceAtBegin

    public static String replaceAtBegin(String source, String from, String to)

  - ### copyToClipboard

    public static void copyToClipboard(String string)
    Shortcut for scripting: Copies `string` to the system clipboard.

  - ### copyHtmlToClipboard

    public static void copyHtmlToClipboard(String html)
    Shortcut for scripting: Copies `html` with mimetype text/html to the system clipboard.

  - ### escapeUtf8

    public static String escapeUtf8(String str)
    The escapeUtf8 method is a stripped down version of the StringEscapeUtils.escapeJava method in Commons Lang 2.6 It escapes the UTF-8 non-ASCII characters in a `String`.

    Such a character becomes `'\\'` and `'u'` followed by a 4 digit hex code.

    Any ASCII character will stay intact

    Example:

         input string: jalapeño
         output string: jalape\u00F1o

    Parameters:
      `str` - String to escape values in, may be null
    Returns:
      String with escaped values, `null` if null string input

  - ### escapeUtf8

    public static void escapeUtf8(Writer out, String str) throws IOException
    Escapes the UTF-8 non-ASCII characters in a `String` to a `Writer`.

    A `null` string input has no effect.

    Parameters:
      `out` - Writer to write escaped string into
      `str` - String to escape values in, may be null
    Throws:
      `IllegalArgumentException` - if the Writer is `null`
      `IOException` - if error occurs on underlying Writer
    See Also:
      - `escapeUtf8(java.lang.String)`