Interface IStringTool

All Known Implementing Classes:
StringToolUnit

public interface IStringTool
The IStringTool provides methods to handle Strings.
Author:
Silvan Wyss
  • Method Details

    • createStringWithoutLastCharacters

      String createStringWithoutLastCharacters(String string, int n)
      Parameters:
      string -
      n -
      Returns:
      a new String that is the given string without the last n characters
      Throws:
      RuntimeException - if the given string is null
      RuntimeException - if the given n is negative or bigger than the length of the given string
    • createTabs

      String createTabs(int tabCount)
      Parameters:
      tabCount -
      Returns:
      a new String consisting of as many tabulators as the given tabCount says
      Throws:
      RuntimeException - if the given tabCount is negative
    • getInBraces

      String getInBraces(Object object)
      Parameters:
      object -
      Returns:
      the String representation of the given object in braces
    • getInParentheses

      String getInParentheses(Object... objects)
      Parameters:
      objects - an array of objects, is considered to be empty when is null
      Returns:
      the String representation of the given objects in parentheses
    • getInSingleQuotes

      String getInSingleQuotes(Object object)
      Parameters:
      object -
      Returns:
      the String representation of the given object in single quotes
    • toBoolean

      boolean toBoolean(String string)
      Parameters:
      string -
      Returns:
      the boolean the given string represents
      Throws:
      RuntimeException - if the given string does not represent a boolean
    • toCapitalSnakeCase

      String toCapitalSnakeCase(String string)
      Parameters:
      string -
      Returns:
      a new String in capital snake case from the given string
    • toDouble

      double toDouble(String string)
      Parameters:
      string -
      Returns:
      the double the given string represents.
      Throws:
      RuntimeException - if the given string does not represent a double
    • toPascalCase

      String toPascalCase(String string)
      Parameters:
      string -
      Returns:
      a new String in Pascal case from the given string
    • toProportion

      double toProportion(String string)
      Parameters:
      string -
      Returns:
      a proportion in [0, 1] from the given string.
      Throws:
      RuntimeException - if the given string does not represent a proportion