Class Utils
java.lang.Object
com.electronwill.nightconfig.core.io.Utils
Serialization utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanarrayContains(char[] array, char element) Checks if an array contains the specified element.static intarrayIndexOf(char[] array, char element) Returns the index, within the specified array, of the first occurrence of the specified character.static doubleparseDouble(CharsWrapper chars) Parses a CharsWrapper that represents a double value.static intparseInt(CharsWrapper chars, int base) Parses a CharsWrapper that represents an int value in the specified base.static longparseLong(CharsWrapper chars, int base) Parses a CharsWrapper that represents a long value in the specified base.
-
Method Details
-
arrayContains
public static boolean arrayContains(char[] array, char element) Checks if an array contains the specified element.- Parameters:
array- the arrayelement- the element to search- Returns:
- true if the array contains the element, false if it doesn't
-
arrayIndexOf
public static int arrayIndexOf(char[] array, char element) Returns the index, within the specified array, of the first occurrence of the specified character. Returns -1 if the array doesn't contains the character.- Parameters:
array- the arrayelement- the element to search- Returns:
- the index of the first occurence of c, or -1 if not found.
-
parseLong
Parses a CharsWrapper that represents a long value in the specified base.- Parameters:
chars- the CharsWrapper representing a longbase- the base of the number- Returns:
- the long value represented by the CharsWrapper
-
parseInt
Parses a CharsWrapper that represents an int value in the specified base.- Parameters:
chars- the CharsWrapper representing an intbase- the base of the number- Returns:
- the int value represented by the CharsWrapper
-
parseDouble
Parses a CharsWrapper that represents a double value.- Parameters:
chars- the CharsWrapper representing a double- Returns:
- the double value represented by the CharsWrapper
-