Java String Left left(String text, int len)

Here you can find the source of left(String text, int len)

Description

left

License

Open Source License

Declaration

public static String left(String text, int len) 

Method Source Code

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

public class Main {

    public static String left(String text, int len) {
        return substring(text, 0, len);
    }/*from w  w  w .  j  a  v a2  s .  co m*/

    public static String substring(String text, int start, int end) {
        if (text == null)
            return null;
        int spos = text.offsetByCodePoints(0, start);
        int epos = text.length() < end ? text.length() : end;
        return text.substring(spos, text.offsetByCodePoints(spos, epos - start));
    }
}

Related

  1. left(String str, int len)
  2. left(String str, int len, String appendStrIfOver)
  3. left(String str, int length)
  4. left(String str, int size)
  5. left(String string, int length)
  6. left(String text, int max)
  7. left(String value, int length)
  8. left(String var0, int var1)