Here you can find the source of left(String str, int len, String appendStrIfOver)
public static String left(String str, int len, String appendStrIfOver)
//package com.java2s; /*!/*w w w . ja va2s .com*/ * mifmi-commons4j * https://github.com/mifmi/mifmi-commons4j * * Copyright (c) 2015 mifmi.org and other contributors * Released under the MIT license * https://opensource.org/licenses/MIT */ public class Main { public static String left(String str, int len) { return left(str, len, null); } public static String left(String str, int len, String appendStrIfOver) { if (str == null) { return null; } if (str.length() <= len) { return str; } if (appendStrIfOver == null || appendStrIfOver.isEmpty()) { return str.substring(0, len); } else { return str.substring(0, len - appendStrIfOver.length()) + appendStrIfOver; } } }