@Test public void testTrim() throws Exception { QuotedSpacePreservingTrimmer trimmer = new QuotedSpacePreservingTrimmer(); assertEquals("abc", trimmer.trim(" abc ")); assertEquals(" abc ", trimmer.trim("\" abc \"")); assertEquals(" \"a\"bc ", trimmer.trim("\" \"a\"bc \"")); assertEquals("\"a\"bc", trimmer.trim("\"a\"bc")); assertEquals("", trimmer.trim("\"\"")); assertNull(trimmer.trim("")); assertNull(trimmer.trim(" \t\n ")); assertNull(trimmer.trim(null)); }
@Override public String trim(String raw) { String s = TextUtil.trimToNull(raw); if (s != null && s.length() > 1 && s.startsWith("\"") && s.endsWith("\"")) { return s.substring(1, s.length() - 1); } else { return s; } }
QuotedSpacePreservingTrimmer implements Trimmer { @Override public String trim(String raw) { String s = TextUtil.trimToNull(raw); if (s != null && s.length() > 1 && s.startsWith("\"") && s.endsWith("\"")) { return s.substring(1, s.length() - 1); } else { return s; } } }
QuotedSpacePreservingTrimmer implements Trimmer { @Override public String trim(String raw) { String s = TextUtil.trimToNull(raw); if (s != null && s.length() > 1 && s.startsWith("\"") && s.endsWith("\"")) { return s.substring(1, s.length() - 1); } else { return s; } }  }
QuotedSpacePreservingTrimmer implements Trimmer { @Override public String trim(String raw) { String s = TextUtil.trimToNull(raw); if (s != null && s.length() > 1 && s.startsWith("\"") && s.endsWith("\"")) { return s.substring(1, s.length() - 1); } else { return s; } }  static QuotedSpacePreservingTrimmer instance(); @Override String trim(String raw); }
QuotedSpacePreservingTrimmer implements Trimmer { @Override public String trim(String raw) { String s = TextUtil.trimToNull(raw); if (s != null && s.length() > 1 && s.startsWith("\"") && s.endsWith("\"")) { return s.substring(1, s.length() - 1); } else { return s; } }  static QuotedSpacePreservingTrimmer instance(); @Override String trim(String raw);  }