Java String Left left(String s, int l)

Here you can find the source of left(String s, int l)

Description

left returns the left most characters of a string

License

Open Source License

Declaration

public static final String left(String s, int l) 

Method Source Code

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

public class Main {
    /**/* w w  w .  java 2  s .  c  om*/
     * left returns the left most characters of a string
     */
    public static final String left(String s, int l) {
        try {
            return s.substring(0, l);
        } catch (StringIndexOutOfBoundsException e) {
            return s;
        }
    }
}

Related

  1. left(final String s, final int len)
  2. left(final String string, final int length)
  3. left(final String text, final String sep)
  4. left(Object src, int length, String defaultValue)
  5. left(String baseString, int pos)
  6. left(String s, int len)
  7. left(String s, int nCaratteri)
  8. left(String s, int size)
  9. left(String s, int width)