Java Path Normalize normalizePath(String fileSystemPath)

Here you can find the source of normalizePath(String fileSystemPath)

Description

Normalizes the filesystem paths so that we only see '/' for the path separator character regardless of host operating system.

License

Open Source License

Parameter

Parameter Description
fileSystemPath The file system path to normalize

Return

The normalized version of the filesystem path

Declaration

public static String normalizePath(String fileSystemPath) 

Method Source Code

//package com.java2s;

public class Main {
    /**                                                                                                                                                                                                  
     * Normalizes the filesystem paths so that we only see '/' for the                                                                                                                                   
     * path separator character regardless of host operating system.                                                                                                                                     
     *                                                                                                                                                                                                   
     * @param fileSystemPath The file system path to normalize                                                                                                                                           
     *                                                                                                                                                                                                   
     * @return The normalized version of the filesystem path                                                                                                                                             
     *///from   w  ww.  j  a  v a  2 s  .co m
    public static String normalizePath(String fileSystemPath) {
        return fileSystemPath.replaceAll("\\\\", "/").replace("//", "/");
    }
}

Related

  1. normalizePath(final String path)
  2. normalizePath(final String... path)
  3. normalizePath(String _path, boolean _appendFinalSeparator)
  4. normalizePath(String absPath)
  5. normalizePath(String filepath)
  6. normalizePath(String path)
  7. normalizePath(String path)
  8. normalizePath(String path)
  9. normalizePath(String path)