All Downloads are FREE. Search and download functionalities are using the official Maven repository.

devutility.internal.lang.IntegerHelper Maven / Gradle / Ivy

There is a newer version: 1.3.8.1
Show newest version
package devutility.internal.lang;

public class IntegerHelper {
	// region Is numeric

	public static boolean isNumberic(String value) {
		for (int i = 0; i < value.length(); i++) {
			if (!Character.isDigit(value.charAt(i))) {
				return false;
			}
		}

		return true;
	}

	// endregion

	// region Try parse to int

	public static IntegerConvertResult tryParse(String value) {
		IntegerConvertResult result = new IntegerConvertResult();

		if (!isNumberic(value)) {
			result.setSucceeded(false);
			return result;
		}

		result.setResult(Integer.valueOf(value));
		result.setSucceeded(true);
		return result;
	}

	// endregion
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy