devutility.internal.lang.IntegerHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devutility.internal Show documentation
Show all versions of devutility.internal Show documentation
Utilities for Java development
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