Java Path String Clean cleanPath(String path)

Here you can find the source of cleanPath(String path)

Description

replace questionable chars in path with percent representation

License

Open Source License

Parameter

Parameter Description
path string representation of path to clean up

Return

sanitized path

Declaration

public static String cleanPath(String path) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**// w  ww . j  a v a 2s  .  c o  m
     * replace questionable chars in path with percent representation
     * 
     * @param path string representation of path to clean up
     * @return sanitized path
     */
    public static String cleanPath(String path) {
        String s;
        s = path.replaceAll("#", "%23");
        s = s.replaceAll(":", "%3A");
        return s;
    }
}

Related

  1. cleanPath(final String path)
  2. cleanPath(final String url)
  3. cleanPath(String loc)
  4. cleanPath(String path)
  5. cleanPath(String path)
  6. cleanPath(String path)
  7. cleanPath(String path)