Here you can find the source of truncateStringAt(String source, int len)
public static String truncateStringAt(String source, int len)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w .j a v a 2 s. c o m*/ Returns a new string that is the first <i>len<i> chars of <i>source</i> */ public static String truncateStringAt(String source, int len) { if (source.length() < len) { return source; } return source.substring(0, len); } }