Java String Left left(Object src, int length, String defaultValue)

Here you can find the source of left(Object src, int length, String defaultValue)

Description

left

License

Open Source License

Declaration

public static String left(Object src, int length, String defaultValue) 

Method Source Code

//package com.java2s;

public class Main {

    public static String left(Object src, int length, String defaultValue) {
        if (src != null) {
            String temp = src.toString();

            if (temp.length() >= length) {
                return temp.substring(0, length);
            }//  ww  w  .  j a  v  a  2  s  .  c o  m

            return temp;
        }

        return defaultValue;
    }
}

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(String baseString, int pos)
  5. left(String s, int l)
  6. left(String s, int len)
  7. left(String s, int nCaratteri)