Class StringTool
java.lang.Object
ch.nolix.base.commontype.stringtool.StringTool
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateStringWithoutLastCharacters(String string, int n) static StringcreateTabs(int tabCount) static StringgetInBraces(Object object) static StringgetInParentheses(Object... objects) static StringgetInSingleQuotes(Object object) static booleanisPascalCase(String string) static booleanstatic StringtoCapitalSnakeCase(String string) static doublestatic StringtoPascalCase(String string) static doubletoProportion(String string)
-
Method Details
-
createStringWithoutLastCharacters
-
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
- Parameters:
object-- Returns:
- the
Stringrepresentation of the given object in braces. - Throws:
RuntimeException- if the given object is null.
-
getInParentheses
- Parameters:
objects-- Returns:
- the
Stringrepresentation of the given objects in parentheses. - Throws:
RuntimeException- if the given objects is nullRuntimeException- if one of the given objects is null.
-
getInSingleQuotes
- Parameters:
object-- Returns:
- the
Stringrepresentation of the given object in single quotes. - Throws:
RuntimeException- if the given object is null.
-
isPascalCase
- Parameters:
string-- Returns:
- true if the given string is in pascal case, false otherwise
-
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.
-