Here you can find the source of cutString(String source, String output, int slength)
public static String cutString(String source, String output, int slength)
//package com.java2s; public class Main { public static String cutString(String source, String output, int slength) { String returnVal = null;/* ww w . java 2s. c om*/ if (source != null) { if (source.length() > slength) { returnVal = source.substring(0, slength) + output; } else returnVal = source; } return returnVal; } public static String cutString(String source, int slength) { String result = null; if (source != null) { if (source.length() > slength) { result = source.substring(0, slength); } else result = source; } return result; } }