StringUtil { public static String extractStringFromTokens(final String tokenString, final String tokens) { String resultString; if (StringUtils.isNotEmpty(tokens)) { final StringTokenizer tk = new StringTokenizer(tokenString, tokens); final StringBuffer outString = new StringBuffer(); while (tk.hasMoreTokens()) { outString.append(tk.nextToken()); } resultString = outString.toString(); } else { resultString = tokenString; } return resultString; }  static String extractStringFromTokens(final String tokenString, final String tokens); static String wrapCdata(final String sText); static String unwrapCdata(final String sText); static String convertToStringUTF8(final byte[] byteArray); static final String UTF8_CHARSET; }
@Test public void testExtractStringFromTokens() { System.out.println("extractStringFromTokens"); String tokenString = "('1.2.3.4')"; String tokens = "'()"; String expResult = "1.2.3.4"; String result = StringUtil.extractStringFromTokens(tokenString, tokens); System.out.println(result); assertEquals(expResult, result); }