Java String Clean cleanText(String text)

Here you can find the source of cleanText(String text)

Description

clean Text

License

Apache License

Declaration

public static String cleanText(String text) 

Method Source Code

//package com.java2s;
//   Licensed under both the CeCILL-B and the Apache License, Version 2.0 

public class Main {
    public static String cleanText(String text) {
        //clean text
        String result = text.replaceAll("[\"()\n]", " ");

        //remove multiple spaces beginning and end
        result = result.trim();//from www .  j  a va2 s .co m

        //remove multiple spaces within the string
        result = result.replaceAll("( )+", " ");

        return result;
    }
}

Related

  1. cleanText(String t)
  2. cleanText(String text)
  3. cleanText(String text)
  4. cleanText(String text)
  5. cleanText(String text)
  6. cleanTextForCSV(final String input)
  7. toText(String content)