0

I need to make sure that a string only contains ASCII characters and not any other character (e.g., from another alphabet). I need to run this in real-time on hundreds of text fields so performance is very important. What is the best way to do this?

5
  • this is amenable to experimentation. what have you tried so far? – cropredy Aug 4 '15 at 17:16
  • What do you mean "hundreds of text field", literally hundreds of fields or a field on hundreds of records? If the latter a validation rule using reggae would be the solution – Eric Aug 4 '15 at 17:32
  • I'm validating the data in ~5 custom objects and 10-20 fields on each for every one record validation. That would mean something like records * 5 * 15 (on average). – Jorjani Aug 4 '15 at 17:45
  • I know I can compare the strings to a list of valid characters but wasn't sure if that's the best way to go as I know my list of valid characters are ASCII characters and it should be a common requirement. – Jorjani Aug 4 '15 at 17:51
  • SFDC regex (Pattern and Matcher) classes would be your friend here – cropredy Aug 4 '15 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.