Don't use strlen (have the user pass the length of the array to the function).

strlen fails on UTF8 strings and should not be used.