Here you can find the source of left(String text, int len)
public static String left(String text, int len)
//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)); } }