Interface IStringTool
- All Known Implementing Classes:
StringToolUnit
public interface IStringTool
The
IStringTool provides methods to handle Strings.- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptioncreateTabs(int tabCount) getInBraces(Object object) intgetIndexOfNextVisibleCharacterOrMinusOne(String string, int startIndex) getInParentheses(Object... objects) getInSingleQuotes(Object object) getWithoutLastCharacters(String string, int n) booleantoCapitalSnakeCase(String string) doubletoPascalCase(String string) doubletoProportion(String string)
-
Method Details
-
createTabs
- Parameters:
tabCount-- Returns:
- a new
Stringconsisting of as many tabulators as the given tabCount says - Throws:
RuntimeException- if the given tabCount is negative
-
getInBraces
-
getIndexOfNextVisibleCharacterOrMinusOne
- Parameters:
string-startIndex-- Returns:
- the index of the next visible character of the given string from the given startIndex if exists, -1 otherwise
-
getInParentheses
-
getInSingleQuotes
-
getWithoutLastCharacters
- Parameters:
string-n-- Returns:
- a new
Stringthat is the given string without the last n characters - Throws:
RuntimeException- if the given string is nullRuntimeException- if the given n is negative or bigger than the length of the given string
-
toBoolean
- Parameters:
string-- Returns:
- the boolean the given string represents
- Throws:
RuntimeException- if the given string does not represent a boolean
-
toCapitalSnakeCase
-
toDouble
- Parameters:
string-- Returns:
- the double the given string represents
- Throws:
RuntimeException- if the given string does not represent a double
-
toPascalCase
-
toProportion
- Parameters:
string-- Returns:
- a proportion in [0, 1] from the given string
- Throws:
RuntimeException- if the given string does not represent a proportion
-