new method to validate max string length