Return a cleaned version of the input String. (Delete leading and trailing whitespace; normalize internal whitespace to single spaces; return an empty String if the input contains nothing but whitespace, but null if the input is null.) @return a cleaned version of the input String.
(String input)
| 264 | * @return a cleaned version of the input String. |
| 265 | */ |
| 266 | public static String cleanString(String input) { |
| 267 | if (input == null) { |
| 268 | return null; |
| 269 | } |
| 270 | // implied else |
| 271 | return input.replaceAll("\\s+", " ").trim(); |
| 272 | } |
| 273 | |
| 274 | /** |
| 275 | * Get the start offset of an annotation. |