Here you can find the source of subStringByte(String str, int toCount, String more)
public static String subStringByte(String str, int toCount, String more)
//package com.java2s; /**/* ww w. j ava2 s . c o m*/ * * Methods Descrip:Converts a line of text into an array of lower case words * using a BreakIterator.wordInstance(). * <p> * * This method is under the Jive Open Source Software License and was * written by Mark Imbriaco. * * @param text * a String of text to convert into an array of words * @return text broken up into an array of words. * */ public class Main { public static String subStringByte(String str, int toCount, String more) { if (str != null && toCount > 0) { if (str.length() > toCount) { str = str.substring(0, toCount - 1) + more; } return str; } else { return ""; } } }