Package net.runelite.client.util
Class Text
- java.lang.Object
-
- net.runelite.client.util.Text
-
public class Text extends java.lang.ObjectA set of utilities to use when dealing with text.
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.base.CharMatcherJAGEX_PRINTABLE_CHAR_MATCHER
-
Constructor Summary
Constructors Constructor Description Text()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringescapeJagex(java.lang.String str)Escapes a string for widgets, replacing < and > with their escaped counterpartsstatic java.util.List<java.lang.String>fromCSV(java.lang.String input)Splits comma separated values to list of stringsstatic booleanmatchesSearchTerms(java.lang.Iterable<java.lang.String> searchTerms, java.util.Collection<java.lang.String> keywords)Checks if all the search terms in the given list matches at least one keyword.static java.lang.StringremoveFormattingTags(java.lang.String str)Remove tags from the given string, except for <lt> and <gt>static java.lang.StringremoveTags(java.lang.String str)Removes all tags from the given string.static java.lang.Stringsanitize(java.lang.String name)Cleans the ironman status icon from playername string if present and corrects spaces.static java.lang.StringsanitizeMultilineText(java.lang.String str)In addition to removing all tags, replaces all <br> delimited text with spaces and all multiple continuous spaces with single spacestatic java.lang.Stringstandardize(java.lang.String str)In addition to removing all tags, replaces nbsp with space, trims string and lowercases itstatic java.lang.StringtitleCase(java.lang.Enum o)If passed in enum doesn't implement its own toString, converts enum name format from THIS_FORMAT to This Format.static java.lang.StringtoCSV(java.util.Collection<java.lang.String> input)Joins collection of strings as comma separated valuesstatic java.lang.StringtoJagexName(java.lang.String str)Convert a string into Jagex username format Remove all non-ascii characters, replace nbsp with space, replace _- with spaces, and trim
-
-
-
Method Detail
-
fromCSV
public static java.util.List<java.lang.String> fromCSV(java.lang.String input)
Splits comma separated values to list of strings- Parameters:
input- input- Returns:
- list of values
-
toCSV
public static java.lang.String toCSV(java.util.Collection<java.lang.String> input)
Joins collection of strings as comma separated values- Parameters:
input- collection- Returns:
- comma separated value string
-
removeTags
public static java.lang.String removeTags(java.lang.String str)
Removes all tags from the given string.- Parameters:
str- The string to remove tags from.- Returns:
- The given string with all tags removed from it.
-
removeFormattingTags
public static java.lang.String removeFormattingTags(java.lang.String str)
Remove tags from the given string, except for <lt> and <gt>- Parameters:
str- The string to remove formatting tags from.- Returns:
- The given string with all formatting tags removed from it.
-
standardize
public static java.lang.String standardize(java.lang.String str)
In addition to removing all tags, replaces nbsp with space, trims string and lowercases it- Parameters:
str- The string to standardize- Returns:
- The given `str` that is standardized
-
toJagexName
public static java.lang.String toJagexName(java.lang.String str)
Convert a string into Jagex username format Remove all non-ascii characters, replace nbsp with space, replace _- with spaces, and trim- Parameters:
str- The string to standardize- Returns:
- The given `str` that is in Jagex name format
-
sanitizeMultilineText
public static java.lang.String sanitizeMultilineText(java.lang.String str)
In addition to removing all tags, replaces all <br> delimited text with spaces and all multiple continuous spaces with single space- Parameters:
str- The string to sanitize- Returns:
- sanitized string
-
escapeJagex
public static java.lang.String escapeJagex(java.lang.String str)
Escapes a string for widgets, replacing < and > with their escaped counterparts
-
sanitize
public static java.lang.String sanitize(java.lang.String name)
Cleans the ironman status icon from playername string if present and corrects spaces.- Parameters:
name- Playername to lookup.- Returns:
- Cleaned playername.
-
titleCase
public static java.lang.String titleCase(java.lang.Enum o)
If passed in enum doesn't implement its own toString, converts enum name format from THIS_FORMAT to This Format.- Parameters:
o- an enum- Returns:
- the enum's name in title case, or if it overrides toString, the value returned by toString
-
matchesSearchTerms
public static boolean matchesSearchTerms(java.lang.Iterable<java.lang.String> searchTerms, java.util.Collection<java.lang.String> keywords)Checks if all the search terms in the given list matches at least one keyword.- Returns:
- true if all search terms matches at least one keyword, or false if otherwise.
-
-