StringArrayUtil { public static String[] substringBefore(String[] strings, String separator) { String[] result = new String[strings.length]; for (int i = 0; i < strings.length; i++) { result[i] = StringUtils.substringBefore(strings[i], separator); } return result; } protected  StringArrayUtil(); static String[] filterBySubstring(String[] strings, String substring); static String[] substringBefore(String[] strings, String separator); static int[] indicesOf(String[] strings, String substring);  }
@Test public void substringBefore() { assertThat( StringArrayUtil.substringBefore(new String[]{"foo", "g1.one", "g2.two", "bar"}, "."), is(new String[] {"foo", "g1", "g2", "bar"})); }