function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lincylincy 

Validating alpha numeric

Can Any Idea about this both alpha numeric and values between 100-200 should work.
ex.zx12should work
ex.101should work
ex.201 should not work.
Any formula idea about this.
Best Answer chosen by lincy
MTBRiderMTBRider
You could do something like this
public static boolean isAlphaAndNumeric(str aN) {
   boolean foundAlpha = false;
   boolean foundNumeric = false;
   for (String s : aN.split('')) {
      if (s.isAlpha()) {
        foundAlpha = true;
      }

      If (s.isNumeric()) {
         foundNumeric = true;
      } 
      if (foundAlpha && foundNumeric) {
          break;
      }
   }
   return foundAlpha && foundNumeric;
}