Class StringToolUnit

java.lang.Object
ch.nolix.base.commontype.stringtool.StringToolUnit
All Implemented Interfaces:
IStringTool

public final class StringToolUnit extends Object implements IStringTool
Author:
Silvan Wyss
  • Constructor Details

    • StringToolUnit

      public StringToolUnit()
  • Method Details

    • createTabs

      public String createTabs(int tabCount)
      Specified by:
      createTabs in interface IStringTool
      Parameters:
      tabCount -
      Returns:
      a new String consisting of as many tabulators as the given tabCount says
    • getInBraces

      public String getInBraces(Object object)
      Specified by:
      getInBraces in interface IStringTool
      Parameters:
      object -
      Returns:
      the String representation of the given object in braces
    • getIndexOfNextVisibleCharacterOrMinusOne

      public int getIndexOfNextVisibleCharacterOrMinusOne(String string, int startIndex)
      Specified by:
      getIndexOfNextVisibleCharacterOrMinusOne in interface IStringTool
      Parameters:
      string -
      startIndex -
      Returns:
      the index of the next visible character of the given string from the given startIndex if exists, -1 otherwise
    • getInParentheses

      public String getInParentheses(Object... objects)
      Specified by:
      getInParentheses in interface IStringTool
      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

      public String getInSingleQuotes(Object object)
      Specified by:
      getInSingleQuotes in interface IStringTool
      Parameters:
      object -
      Returns:
      the String representation of the given object in single quotes
    • getWithoutLastCharacters

      public String getWithoutLastCharacters(String string, int n)
      Specified by:
      getWithoutLastCharacters in interface IStringTool
      Parameters:
      string -
      n -
      Returns:
      a new String that is the given string without the last n characters
    • toBoolean

      public boolean toBoolean(String string)
      Specified by:
      toBoolean in interface IStringTool
      Parameters:
      string -
      Returns:
      the boolean the given string represents
    • toCapitalSnakeCase

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

      public double toDouble(String string)
      Specified by:
      toDouble in interface IStringTool
      Parameters:
      string -
      Returns:
      the double the given string represents
    • toPascalCase

      public String toPascalCase(String string)
      Specified by:
      toPascalCase in interface IStringTool
      Parameters:
      string -
      Returns:
      a new String in Pascal case from the given string
    • toProportion

      public double toProportion(String string)
      Specified by:
      toProportion in interface IStringTool
      Parameters:
      string -
      Returns:
      a proportion in [0, 1] from the given string