@Test public void shouldNotIncludeIgnoreWordsWhenSplittingString() { String test = "Some area of London. Testing ignore words."; Set<String> strings = StringTools.splitIntoWordsWithLengthHigherThan(test, 3, "ignore", "area", "of", "some"); assertThat(strings.contains("London."), equalTo(true)); assertThat(strings.contains("Testing"), equalTo(true)); assertThat(strings.contains("some"), equalTo(false)); assertThat(strings.contains("of"), equalTo(false)); assertThat(strings.contains("area"), equalTo(false)); assertThat(strings.contains("ignore"), equalTo(false)); }
public static Set<String> splitIntoWordsWithLengthHigherThan(String string, int minLength) { Set<String> strings = new HashSet<>(); if (StringUtils.isBlank(string)) { return strings; } String[] splitArray = string.split(" "); for (String word : splitArray) { if (word.length() > minLength) { strings.add(word); } } return strings; }
StringTools { public static Set<String> splitIntoWordsWithLengthHigherThan(String string, int minLength) { Set<String> strings = new HashSet<>(); if (StringUtils.isBlank(string)) { return strings; } String[] splitArray = string.split(" "); for (String word : splitArray) { if (word.length() > minLength) { strings.add(word); } } return strings; } }
StringTools { public static Set<String> splitIntoWordsWithLengthHigherThan(String string, int minLength) { Set<String> strings = new HashSet<>(); if (StringUtils.isBlank(string)) { return strings; } String[] splitArray = string.split(" "); for (String word : splitArray) { if (word.length() > minLength) { strings.add(word); } } return strings; }  }
StringTools { public static Set<String> splitIntoWordsWithLengthHigherThan(String string, int minLength) { Set<String> strings = new HashSet<>(); if (StringUtils.isBlank(string)) { return strings; } String[] splitArray = string.split(" "); for (String word : splitArray) { if (word.length() > minLength) { strings.add(word); } } return strings; }  static int getLevenshteinDistance(String str1, String str2); static Set<String> getApproximatelyMatchingStringList(String sourceString, String search); boolean isNotTooShort(String string); static Set<String> getApproximatelyMatchingStringList(String sourceString, String search, int maxDistance); static String getCompletingString(String string, int begin, int end); static List<MatchingWindow> getMatchingWindowsAboveThreshold(String text, String search, double threshold); static Set<String> splitIntoWordsWithLengthHigherThan(String string, int minLength); static Set<String> splitIntoWordsWithLengthHigherThan(String string, int minLength, String... ignoreWords); static boolean noContentInHtml(String text); static List<String> getRegexMatchesWithMinLength(String text, String regex, int minLength); static String getRandomForeName(); static String getRandomSurname(); static String getFirstHtmlWithContent(String html); static String getMetaDataFromHTML(String html); static String addMetaDataToHtml(String htmlText, String metaData); }
StringTools { public static Set<String> splitIntoWordsWithLengthHigherThan(String string, int minLength) { Set<String> strings = new HashSet<>(); if (StringUtils.isBlank(string)) { return strings; } String[] splitArray = string.split(" "); for (String word : splitArray) { if (word.length() > minLength) { strings.add(word); } } return strings; }  static int getLevenshteinDistance(String str1, String str2); static Set<String> getApproximatelyMatchingStringList(String sourceString, String search); boolean isNotTooShort(String string); static Set<String> getApproximatelyMatchingStringList(String sourceString, String search, int maxDistance); static String getCompletingString(String string, int begin, int end); static List<MatchingWindow> getMatchingWindowsAboveThreshold(String text, String search, double threshold); static Set<String> splitIntoWordsWithLengthHigherThan(String string, int minLength); static Set<String> splitIntoWordsWithLengthHigherThan(String string, int minLength, String... ignoreWords); static boolean noContentInHtml(String text); static List<String> getRegexMatchesWithMinLength(String text, String regex, int minLength); static String getRandomForeName(); static String getRandomSurname(); static String getFirstHtmlWithContent(String html); static String getMetaDataFromHTML(String html); static String addMetaDataToHtml(String htmlText, String metaData);  }