I need to find out if a string contains only one alphanumeric character. The obvious solution would be to check the length and ASCII code ( A-Z, A-Z, 0-9), but the problem is that I work with UTF-8 strings and accented letters, such as á, ř, č, etc.
Is there an easy way to check if a UTF-8 character is alphanumeric (a Latin letter of the alphabet, perhaps an accent or a number)?
source
share