How to check if a string is all lowercase and alphanumerics?

unwise guy picture unwise guy · Jul 3, 2012 · Viewed 10.5k times · Source

Is there a method that checks for these cases? Or do I need to parse each letter in the string, and check if it's lower case (letter) and is a number/letter?

Answer

Oleksi picture Oleksi · Jul 3, 2012

You can use islower(), isalnum() to check for those conditions for each character. There is no string-level function to do this, so you'll have to write your own.