+ /**
+ * Checks if the {@link CharSequence} is a prefix of a valid number, and returns the NumberType it is a prefix of. If a String is a
+ * prefix of multiple different {@link NumberType}s, the one with the smallest radix is returned. If no valid {@link NumberType} is
+ * found, {@link NumberType#NONE} is returned.
+ *
+ * @param cs The potential prefix
+ * @return The type the {@link CharSequence} is a prefix of
+ */
+ public static NumberType prefixOfType(CharSequence cs)
+ {
+ if (isPrefix(cs, numberBin))
+ return NumberType.BINARY;
+ if (isPrefix(cs, numberOct))
+ return NumberType.OCTAL;
+ if (isPrefix(cs, numberDec))
+ return NumberType.DECIMAL;
+ if (isPrefix(cs, numberHex))
+ return NumberType.HEXADECIMAL;
+ if (isPrefix(cs, numberFloat))
+ return NumberType.FLOATINGPOINT;
+ return NumberType.NONE;
+ }
+