Class StringToolUnit
java.lang.Object
ch.nolix.base.commontype.stringtool.StringToolUnit
- All Implemented Interfaces:
IStringTool
- Author:
- Silvan Wyss
-
Constructor Summary
Constructors -
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)
-
Constructor Details
-
StringToolUnit
public StringToolUnit()
-
-
Method Details
-
createTabs
- Specified by:
createTabsin interfaceIStringTool- Parameters:
tabCount-- Returns:
- a new
Stringconsisting of as many tabulators as the given tabCount says
-
getInBraces
- Specified by:
getInBracesin interfaceIStringTool- Parameters:
object-- Returns:
- the
Stringrepresentation of the given object in braces
-
getIndexOfNextVisibleCharacterOrMinusOne
- Specified by:
getIndexOfNextVisibleCharacterOrMinusOnein interfaceIStringTool- Parameters:
string-startIndex-- Returns:
- the index of the next visible character of the given string from the given startIndex if exists, -1 otherwise
-
getInParentheses
- Specified by:
getInParenthesesin interfaceIStringTool- Parameters:
objects- an array of objects, is considered to be empty when is null- Returns:
- the
Stringrepresentation of the given objects in parentheses
-
getInSingleQuotes
- Specified by:
getInSingleQuotesin interfaceIStringTool- Parameters:
object-- Returns:
- the
Stringrepresentation of the given object in single quotes
-
getWithoutLastCharacters
- Specified by:
getWithoutLastCharactersin interfaceIStringTool- Parameters:
string-n-- Returns:
- a new
Stringthat is the given string without the last n characters
-
toBoolean
- Specified by:
toBooleanin interfaceIStringTool- Parameters:
string-- Returns:
- the boolean the given string represents
-
toCapitalSnakeCase
- Specified by:
toCapitalSnakeCasein interfaceIStringTool- Parameters:
string-- Returns:
- a new
Stringin capital snake case from the given string
-
toDouble
- Specified by:
toDoublein interfaceIStringTool- Parameters:
string-- Returns:
- the double the given string represents
-
toPascalCase
- Specified by:
toPascalCasein interfaceIStringTool- Parameters:
string-- Returns:
- a new
Stringin Pascal case from the given string
-
toProportion
- Specified by:
toProportionin interfaceIStringTool- Parameters:
string-- Returns:
- a proportion in [0, 1] from the given string
-