in this apex code the expected output was not getting the question is Take a string type of variable
string pincode = '500038';
- Pincode must be exactly 6 digits, if the number of digits not equal to 6 then print "Pincode must be 6 digits"
- Pincode must be numerics only, if user enters alphabets then show error message "Pincode must be numerics only"
I tried this code
string pincode = '500038';
if (pincode.isNumeric()) {
system.debug('Pincode must be numeric only');
if (pincode.len == 6) {
system.debug('Pincode must be 6 digits');
}
}
Aucun commentaire:
Enregistrer un commentaire