Package gaiasky.util

Class TextUtils

java.lang.Object
gaiasky.util.TextUtils

public class TextUtils extends Object
Contains some general utilities to deal with text and strings.
  • Constructor Details

    • TextUtils

      public TextUtils()
  • Method Details

    • surroundBrackets

      public static String surroundBrackets(String in)
    • surround

      public static String surround(String in, String pre, String post)
    • breakCharacters

      public static String breakCharacters(CharSequence in, int breakChars)
    • breakCharacters

      public static String breakCharacters(String in, int breakChars)
    • countLines

      public static long countLines(String str)
    • breakSpaces

      public static String breakSpaces(CharSequence in, int breakSpaces)
    • breakSpaces

      public static String breakSpaces(String in, int breakSpaces)
    • capLabelWidth

      public static void capLabelWidth(com.badlogic.gdx.scenes.scene2d.ui.Label l, float targetWidth)
    • limitWidth

      public static CharSequence limitWidth(CharSequence text, float width, float letterWidth)
    • capString

      public static String capString(String in, int targetLength)
    • capString

      public static String capString(String in, int targetLength, boolean fromStart)
    • propertyToMethodName

      public static String propertyToMethodName(String property)
      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

      public static String capitalise(String line)
      Returns the given string with the first letter capitalised
      Parameters:
      line - The input string
      Returns:
      The string with its first letter capitalised
    • trueCapitalise

      public static String trueCapitalise(String line)
      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

      public static String concatenate(String split, String... strs)
      Concatenates the strings using the given split
      Parameters:
      split - The split
      strs - The strings
      Returns:
      The concatenation
    • concatenate

      public static String concatenate(String split, com.badlogic.gdx.utils.Array<String> strings)
      Concatenates the strings using the given split
      Parameters:
      split - The split
      strings - The strings
      Returns:
      The concatenation
    • concatenate

      public static String concatenate(String split, List<String> strings)
      Concatenates the strings using the given split
      Parameters:
      split - The split
      strings - The strings
      Returns:
      The concatenation
    • arrayToStr

      public static String arrayToStr(String[] arr)
    • arrayToStr

      public static String arrayToStr(String[] arr, String pre, String post, String sep)
    • setToStr

      public static String setToStr(Set<String> set)
    • setToStr

      public static String setToStr(Set<String> set, String pre, String post, String sep)
    • getFormattedTimeWarp

      public static String getFormattedTimeWarp(double warp)
    • getFormattedTimeWarp

      public static String getFormattedTimeWarp()
    • concatAll

      public static String[] concatAll(String base, String[] suffixes)
      Concatenates the base with each of the strings in suffixes
      Parameters:
      base - The base string
      suffixes - All the suffixes
      Returns:
      The result
    • concatAll

      public static String[] concatAll(String base, String[] suffixes, String suffixAdditional)
    • contains

      public static boolean contains(String[] list, String key)
    • contains

      public static boolean contains(String[] list, String key, boolean ignoreCase)
    • ensureStartsWith

      public static String ensureStartsWith(String base, String start)
    • contains

      public static boolean contains(String name, List<String> list)
    • containsOrMatches

      public static boolean containsOrMatches(String[] list, String key, boolean ignoreCase)
    • html2text

      public static String html2text(String html)
    • unescape

      public static final String unescape(String oldstr)