code: public static String trimClean(String text) {
  
      while (text.contains(CARRIAGE_RETURN)) {
        text = text.replace(CARRIAGE_RETURN, " ");
      }
  
      while (text.contains(CARRIAGE)) {
        text = text.replace(CARRIAGE, " ");
      }
  
      while (text.contains(RETURN)) {
        text = text.replace(RETURN, " ");
      }
  
      while (text.contains("\b")) {
        text = text.replace("\b", " ");
      }
  
      text = text.replaceAll("\\s+", " ");
  
      return text.trim();
    }
docs: /*
  Removed - use https://github.com/rrice/java-string-similarity public static double
  similarScore(String str1, String str2) { SimilarityStrategy strategy = new
  JaroWinklerStrategy(); StringSimilarityService service = new StringSimilarityServiceImpl(
  strategy);
  
  return service.score(str1, str2); } public static String[] fileSimilar(File dir, String name) {
  return fileSimilar(dir, name, 50); }
  
  public static String[] fileSimilar(File dir, String name, int adherence) { File mostSimilar =
  null; double similarity = 0;
  
  for (File arq : dir.listFiles()) { if (arq.isDirectory()) { continue; }
  
  double score = similarScore(arq.getName(), name);
  
  if (score >= (adherence / 100.0) && score > similarity) { mostSimilar = arq; similarity =
  score; } }
  
  if (mostSimilar == null) { return new String[] { null, "0" }; } return new String[] {
  mostSimilar.getName(), String.valueOf(similarity) }; }