Example 1:
String value = 'abc';
boolean isNonNumericValue = pattern.matches('[a-zA-Z]+',value);
if(isNonNumericValue == true) {
system.debug('Non Numeric');
} else {
system.debug('Numeric');
}
Output:
Example 2:
String value = '123';
boolean isNonNumericValue = pattern.matches('[a-zA-Z]+',value);
if(isNonNumericValue == true) {
system.debug('Non Numeric');
} else {
system.debug('Numeric');
}
Output:
String value = 'abc';
boolean isNonNumericValue = pattern.matches('[a-zA-Z]+',value);
if(isNonNumericValue == true) {
system.debug('Non Numeric');
} else {
system.debug('Numeric');
}
Output:
Example 2:
String value = '123';
boolean isNonNumericValue = pattern.matches('[a-zA-Z]+',value);
if(isNonNumericValue == true) {
system.debug('Non Numeric');
} else {
system.debug('Numeric');
}
Output:
No comments:
Post a Comment