11.10.2014, 21:55
It's probably easier to check for invalid characters. But looking at this the problem is probably that you aren't considering the end string character which is "\0" I believe. If the string only contains the valid characters you have listed then checkamount has to equal length - 1