Java String Leading Character addLeadingUnixSlash(String fileName)

Here you can find the source of addLeadingUnixSlash(String fileName)

Description

Adds the leading slash if needed on the beginning of a filename.

License

Apache License

Parameter

Parameter Description
fileName a parameter

Declaration

public static String addLeadingUnixSlash(String fileName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**/*  w w w .  j a v  a2  s .c om*/
     * Adds the leading slash if needed on the beginning of a filename.
     * @param fileName
     */
    public static String addLeadingUnixSlash(String fileName) {
        if (fileName.startsWith("/")) {
            return fileName;
        }
        return "/" + fileName;
    }
}

Related

  1. addLeadingSlash(String path)
  2. addLeadingSlash(String path)
  3. addLeadingSlash(String string)
  4. addLeadingSpace(String s, int len)
  5. addLeadingSpace(String s, int len)
  6. addLeadingZero(byte[] value)
  7. addLeadingZero(final int value)
  8. addLeadingZero(String aString, int aAmountOfZeros)
  9. addLeadingZeroesTo16BitBinaryString(String binaryValue)