Java Path Normalize normalisePath(final String path)

Here you can find the source of normalisePath(final String path)

Description

normalise Path

License

Open Source License

Parameter

Parameter Description
path a parameter

Return

String

Declaration

public static String normalisePath(final String path) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Manchester Centre for Integrative Systems Biology
 * University of Manchester//from   www.  j  a v  a2s .c o m
 * Manchester M1 7ND
 * United Kingdom
 * 
 * Copyright (C) 2007 University of Manchester
 * 
 * This program is released under the Academic Free License ("AFL") v3.0.
 * (http://www.opensource.org/licenses/academic.php)
 *******************************************************************************/

public class Main {
    /**
     * 
     * @param path
     * @return String
     */
    public static String normalisePath(final String path) {
        final char BACK_SLASH = '\\';
        final char FORWARD_SLASH = '/';
        final String SPACE = " "; //$NON-NLS-1$
        final String SPACE_ESCAPE = "%20"; //$NON-NLS-1$
        return path.replace(BACK_SLASH, FORWARD_SLASH).replace(SPACE, SPACE_ESCAPE);
    }
}

Related

  1. normalise(String path)
  2. normalisePath(String path)
  3. normalisePath(String path)
  4. normalize(final boolean absolutize, final String... path)
  5. normalize(final String path)