...
Code Block | ||
---|---|---|
| ||
boolean isCapitalized(String s) {
try {
if (s.equals("")) {
return true;
}
String first = s.substring( 0, 1);
String rest = s.substring( 1);
return (first.equals( first.toUpperCase()) &&
rest.equals( rest.toLowerCase()));
} catch (RuntimeException exception) {
ExceptionReporter.report( exception);
}
return false;
}
|
...
Code Block | ||
---|---|---|
| ||
boolean isCapitalized(String s) { try { if (s.equals("")) { return true; } String first = s.substring( 0, 1); String rest = s.substring( 1); return (first.equals( first.toUpperCase()) && rest.equals( rest.toLowerCase())); } catch (NullPointerException exception) { ExceptionReporter.report( exception); } catch (IndexOutOfBoundsException exception) { ExceptionReporter.report( exception); } return false; } |
...