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

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

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

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

		return true;
	}

	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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy