added function validate to String/StringType.php