Class Utils
- java.lang.Object
-
- com.electronwill.nightconfig.core.io.Utils
-
public final class Utils extends java.lang.ObjectSerialization utilities.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
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
public static long parseLong(CharsWrapper chars, int base)
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
public static int parseInt(CharsWrapper chars, int base)
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
public static double parseDouble(CharsWrapper chars)
Parses a CharsWrapper that represents a double value.- Parameters:
chars- the CharsWrapper representing a double- Returns:
- the double value represented by the CharsWrapper
-
-