Java String Sub String subStringByte(String str, int toCount, String more)

Here you can find the source of subStringByte(String str, int toCount, String more)

Description

sub String Byte

License

LGPL

Declaration

public static String subStringByte(String str, int toCount, String more) 

Method Source Code

//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 "";
        }
    }
}

Related

  1. subStringByByte(String str, int byteLenth)
  2. substringByByteCount(String str, int byteCount)
  3. subStringByBytes(String str, int toCount, String more)
  4. substringByCodePoint(String inputStr, int codePointStart, int codePointEnd)
  5. substringByMask(String baseString, String baseMask, String subMask)
  6. substringBytes(String value, int byte_len)
  7. substringCompare(String string, int index, char... characters)
  8. substringDelimited(String string, String start, String end, int startingPosition)
  9. substringEL(String str, int index, String defaultValue)