@Test public void trimSpaces () { assertEquals("short", StringUtils.trimSpaces(" short ")); assertEquals("short", StringUtils.trimSpaces("short ")); assertEquals("short", StringUtils.trimSpaces(" short")); assertEquals("longer sentence", StringUtils.trimSpaces(" longer sentence ")); assertEquals("longer sentence", StringUtils.trimSpaces(" longer sentence")); assertEquals("longer sentence", StringUtils.trimSpaces("longer sentence ")); }
public static String trimSpaces (String original) { return original.replaceFirst("^\\s*(.*?)\\s*$", "$1"); }
StringUtils { public static String trimSpaces (String original) { return original.replaceFirst("^\\s*(.*?)\\s*$", "$1"); } }
StringUtils { public static String trimSpaces (String original) { return original.replaceFirst("^\\s*(.*?)\\s*$", "$1"); } private  StringUtils(); }
StringUtils { public static String trimSpaces (String original) { return original.replaceFirst("^\\s*(.*?)\\s*$", "$1"); } private  StringUtils(); static String addQuotesIfNecessary(String string); static String generateRandomString(int length); static String convertCamelCaseToSentence(String camelCase); static String trimSpaces(String original); }
StringUtils { public static String trimSpaces (String original) { return original.replaceFirst("^\\s*(.*?)\\s*$", "$1"); } private  StringUtils(); static String addQuotesIfNecessary(String string); static String generateRandomString(int length); static String convertCamelCaseToSentence(String camelCase); static String trimSpaces(String original);  }