Package de.eldoria.eldoutilities.utils
Class Parser
java.lang.Object
de.eldoria.eldoutilities.utils.Parser
This class contains methods to parse strings to primitve types and other things.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionParse a string to a booleanparseBoolean
(String s, String trueValue, String falseValue) Parse a string to a booleanParse a string to a double.Parse a string to a int.static String
parseTicksToTime
(long ticks) Parses ticks to a time with format H24:mm.static OptionalInt
Parses a time in format H24:mm to ticks.
-
Method Details
-
parseInt
Parse a string to a int.- Parameters:
s
- string to parse- Returns:
- optional integer with integer when the parsing was successful.
-
parseDouble
Parse a string to a double.- Parameters:
s
- string to parse- Returns:
- optional double with double when the parsing was successful.
-
parseBoolean
Parse a string to a boolean- Parameters:
s
- string to parse- Returns:
- optional boolean with boolean when the parsing was successful.
-
parseBoolean
Parse a string to a boolean- Parameters:
s
- string to parsetrueValue
- true value as stringfalseValue
- false value as string- Returns:
- optional boolean with boolean when the parsing was successful.
-
parseTimeToTicks
Parses a time in format H24:mm to ticks.- Parameters:
s
- string to parse- Returns:
- time as ticks or null if value could not be parsed.
-
parseTicksToTime
Parses ticks to a time with format H24:mm.- Parameters:
ticks
- ticks to parse- Returns:
- ticks as time
-
parseLong
-