Java URL Clear cleanURL(final String input)

Here you can find the source of cleanURL(final String input)

Description

This method is used to remove extra characters from a URL.

License

Open Source License

Parameter

Parameter Description
input a parameter

Declaration

public static synchronized String cleanURL(final String input) 

Method Source Code

//package com.java2s;
/*//www .  j  av  a2s .co  m
 * TextUtils.java
 *
 * Created on October 28, 2005, 10:33 PM
 *
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

public class Main {
    /**
     * This method is used to remove extra characters from a URL.
     * Thoug not entirely scientific, it will get rid of things like trailing
     * quotation marks
     * @param input
     * @return
     */
    public static synchronized String cleanURL(final String input) {
        // Remove quotation marks
        String output = input.replace("\"", "");

        // convert spaces to %22
        output = output.replace(" ", "%22");

        return output;
    }
}

Related

  1. cleanUrl(String encodedUrl)
  2. cleanUrl(String uriStr)
  3. cleanUrl(String url)
  4. cleanUrl(String url)