Package gaiasky.util
Class TextUtils
java.lang.Object
gaiasky.util.TextUtils
Contains some general utilities to deal with text and strings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringarrayToStr(String[] arr) static StringarrayToStr(String[] arr, String pre, String post, String sep) static StringbreakCharacters(CharSequence in, int breakChars) Breaks the character sequence with new line characters '\n' so that the lines have approximatelybreakCharscharacters.static StringbreakCharacters(String in, int breakChars) Breaks the string with new line characters '\n' so that the lines have approximatelybreakCharscharacters.static StringbreakCharacters(String in, int breakChars, boolean forceBreak) Breaks the string with new line characters '\n' so that the lines have approximatelybreakCharscharacters.static StringbreakSpaces(CharSequence in, int breakSpaces) static StringbreakSpaces(String in, int breakSpaces) static Stringcapitalise(String line) Returns the given string with the first letter capitalisedstatic voidcapLabelWidth(com.badlogic.gdx.scenes.scene2d.ui.Label l, float targetWidth) static Stringstatic Stringstatic String[]Concatenates the base with each of the strings in suffixesstatic String[]static Stringconcatenate(String split, com.badlogic.gdx.utils.Array<String> strings) Concatenates the strings using the given splitstatic Stringconcatenate(String split, String... strs) Concatenates the strings using the given splitstatic Stringconcatenate(String split, List<String> strings) Concatenates the strings using the given splitstatic booleanstatic booleanstatic booleanstatic booleancontainsOrMatches(String[] list, String key, boolean ignoreCase) static longcountLines(String str) static StringensureStartsWith(String base, String start) static Stringstatic StringgetFormattedTimeWarp(double warp) static Stringstatic CharSequencelimitWidth(CharSequence text, float width, float letterWidth) static StringpropertyToMethodName(String property) Converts from property displayName to method displayName by removing the separator dots and capitalising each chunk.static Stringstatic Stringstatic Stringstatic Stringstatic StringtrueCapitalise(String line) Returns the given string with the first letter capitalised and all the others in lower casestatic final String
-
Constructor Details
-
TextUtils
public TextUtils()
-
-
Method Details
-
surroundBrackets
-
surround
-
breakCharacters
Breaks the character sequence with new line characters '\n' so that the lines have approximatelybreakCharscharacters.- Parameters:
in- The character sequence.breakChars- The number of characters per line.- Returns:
- The string, broken into lines.
-
breakCharacters
Breaks the string with new line characters '\n' so that the lines have approximatelybreakCharscharacters.- Parameters:
in- The string.breakChars- The number of characters per line.- Returns:
- The string, broken into lines.
-
breakCharacters
Breaks the string with new line characters '\n' so that the lines have approximatelybreakCharscharacters.- Parameters:
in- The string.breakChars- The number of characters per line.forceBreak- Break the string even when there are not separator characters.- Returns:
- The string, broken into lines.
-
countLines
-
breakSpaces
-
breakSpaces
-
capLabelWidth
public static void capLabelWidth(com.badlogic.gdx.scenes.scene2d.ui.Label l, float targetWidth) -
limitWidth
-
capString
-
capString
-
propertyToMethodName
Converts from property displayName to method displayName by removing the separator dots and capitalising each chunk. Example: model.texture.bump -> ModelTextureBump- Parameters:
property- The property displayName- Returns:
- The method name
-
capitalise
Returns the given string with the first letter capitalised- Parameters:
line- The input string- Returns:
- The string with its first letter capitalised
-
trueCapitalise
Returns the given string with the first letter capitalised and all the others in lower case- Parameters:
line- The input string- Returns:
- The string with its first letter capitalised and the others in lower case
-
concatenate
Concatenates the strings using the given split- Parameters:
split- The splitstrs- The strings- Returns:
- The concatenation
-
concatenate
Concatenates the strings using the given split- Parameters:
split- The splitstrings- The strings- Returns:
- The concatenation
-
concatenate
Concatenates the strings using the given split- Parameters:
split- The splitstrings- The strings- Returns:
- The concatenation
-
arrayToStr
-
arrayToStr
-
setToStr
-
setToStr
-
getFormattedTimeWarp
-
getFormattedTimeWarp
-
concatAll
Concatenates the base with each of the strings in suffixes- Parameters:
base- The base stringsuffixes- All the suffixes- Returns:
- The result
-
concatAll
-
contains
-
contains
-
ensureStartsWith
-
contains
-
containsOrMatches
-
html2text
-
unescape
-