I need to check if all characters of a string are in a specific character range.
I know I can check with the regular expression:
input.matches("[a-z]+");
if a string only contains letters from a to z. But how can I do it if the character range is defined by an given interface? For example, the interface xxx has the attribute
xxx.FIRST_CHAR = 'a';
and
xxx.LAST_CHAR = 'z';
but the attributes can be changed.
Is there any way to use variable characters in regular expressions?
Aucun commentaire:
Enregistrer un commentaire