MagicTxt

open class MagicTxt

Contains some String-related utility functions.

Author

Tartiflette, Wisp

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
Takes a string with the format "This is a ==highlighted== sentence with ==words==.

Functions

Link copied to clipboard
open fun addPara(text: TextPanelAPI, str: String, textColor: Color, highlightColor: Color)
Uses MagicDisplayableText to add a paragraph to the given TextPanelAPI.
open fun addPara(text: TooltipMakerAPI, str: String, padding: Float, textColor: Color, highlightColor: Color)
Uses MagicDisplayableText to add a paragraph to the given TooltipMakerAPI.
Link copied to clipboard
Takes a string with the format "This is a ==highlighted word== string.
Link copied to clipboard
open fun ellipsizeStringAfterLength(str: String, length: Int): String
If the string is longer than the given length, returns the string truncated to the given length with "..." appended.
Link copied to clipboard
open fun getString(id: String): String
open fun getString(id: String, args: Array<String>): String
Link copied to clipboard
open fun nullStringIfEmpty(input: String): String
If the input is an empty string, returns null.
Link copied to clipboard
open fun replaceAllIfPresent(stringToReplace: String, regex: String, stringCreator: StringCreator): String
Replaces all instances of the given regex with the string returned from stringCreator.