You need to sign in to do that
Don't have an account?
ForceCom
Pattern Matching
Hi,
I am trying to check if an integer field has a string value , if yes display an error.
if(totalunit != '' && totalunit != null && !Pattern.matches('\\d*', totalunit)){
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'WARNING: Total Unit Quanitity Requested Only Accepts Number.'));
return null;
}
I am facing an error saying " Comparison arguments must be compatible types: Integer, String".
I would appreciate any help or pointers ...
Thank you
You have to cast the totalunit to string before you do a matching..
You could do something like this
Hope it helps!!