@Test public void filterShortWords_ZERO_LENGTH() { assertEquals("a bc cde fg h", stringFilter.filterShortWords("a bc cde fg h", 0)); }
public String filterShortWords(String value, int wordToRemoveMaxLength) { if (wordToRemoveMaxLength == 0) { return value; } String filteredValue = value; filteredValue = PatternUtils.removePattern(filteredValue, "\\b\\w{1," + wordToRemoveMaxLength + "}\\b"); filteredValue = filteredValue.trim().replaceAll(" +", " "); return filteredValue; }
StringFilter implements Serializable { public String filterShortWords(String value, int wordToRemoveMaxLength) { if (wordToRemoveMaxLength == 0) { return value; } String filteredValue = value; filteredValue = PatternUtils.removePattern(filteredValue, "\\b\\w{1," + wordToRemoveMaxLength + "}\\b"); filteredValue = filteredValue.trim().replaceAll(" +", " "); return filteredValue; } }
StringFilter implements Serializable { public String filterShortWords(String value, int wordToRemoveMaxLength) { if (wordToRemoveMaxLength == 0) { return value; } String filteredValue = value; filteredValue = PatternUtils.removePattern(filteredValue, "\\b\\w{1," + wordToRemoveMaxLength + "}\\b"); filteredValue = filteredValue.trim().replaceAll(" +", " "); return filteredValue; }  }
StringFilter implements Serializable { public String filterShortWords(String value, int wordToRemoveMaxLength) { if (wordToRemoveMaxLength == 0) { return value; } String filteredValue = value; filteredValue = PatternUtils.removePattern(filteredValue, "\\b\\w{1," + wordToRemoveMaxLength + "}\\b"); filteredValue = filteredValue.trim().replaceAll(" +", " "); return filteredValue; }  String filterCharsAndShortWords(String value, List<Character> charsToFilter, int wordToRemoveMaxLength); String filterChars(String value, List<Character> charsToFilter); String filterShortWords(String value, int wordToRemoveMaxLength); }
StringFilter implements Serializable { public String filterShortWords(String value, int wordToRemoveMaxLength) { if (wordToRemoveMaxLength == 0) { return value; } String filteredValue = value; filteredValue = PatternUtils.removePattern(filteredValue, "\\b\\w{1," + wordToRemoveMaxLength + "}\\b"); filteredValue = filteredValue.trim().replaceAll(" +", " "); return filteredValue; }  String filterCharsAndShortWords(String value, List<Character> charsToFilter, int wordToRemoveMaxLength); String filterChars(String value, List<Character> charsToFilter); String filterShortWords(String value, int wordToRemoveMaxLength);  }