Here you can find the source of truncateFirstEnd(String str)
public static String truncateFirstEnd(String str)
//package com.java2s; //License from project: Apache License public class Main { public static String truncateFirstEnd(String str) { if (isEmpty(str)) return str; String tmp = str.substring(1); return tmp.substring(0, tmp.length() - 1); }/*from w ww . j av a 2s . c o m*/ public static boolean isEmpty(String str) { return str == null || (str.trim().length() == 0); } public static String subString(String src, String begin, String end) { return subString(src, 0, begin, end); } public static String subString(String src, int offset, String begin, String end) { if (isEmpty(src) || offset >= src.length()) return ""; int b = offset; int e = src.length(); if (!isEmpty(begin)) { b = src.indexOf(begin, offset); if (b < 0) return ""; b += begin.length(); } if (!isEmpty(end) && b < e) { e = src.indexOf(end, b); if (e < 0) e = src.length(); } return src.substring(b, e); } }