tidying string to char conversion
This commit is contained in:
parent
5c3e71d494
commit
e153a1a968
|
|
@ -30,6 +30,9 @@ class StringToCharacterConverter implements Converter<String, Character> {
|
|||
if ("".equals(source)) {
|
||||
return null;
|
||||
}
|
||||
if (source.length() > 1) {
|
||||
throw new IllegalArgumentException("Can only convert a [String] with length of 1 to a [Character]; string value '" + source + "' has length of " + source.length());
|
||||
}
|
||||
return source.charAt(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue