I'm sorry that other version was so incredibly complicated. I wasn't really sure what kind of character you wanted the routine to accept, so I had to be explicit with std::isalnum and stuff so you could modify it with better understanding. That size thing was just my fault... I forgot about empty!