Java String Truncate truncateData(String data, int idLength)

Here you can find the source of truncateData(String data, int idLength)

Description

truncate Data

License

Open Source License

Declaration

public static String truncateData(String data, int idLength) 

Method Source Code

//package com.java2s;

public class Main {
    public static String truncateData(String data, int idLength) {
        //TODO: Handle the case of unicode chars where string.length() <> byte length
        String truncateData = data;
        if (data != null && data.length() > idLength) {
            truncateData = data.substring(0, (idLength - 1));
        }/*  ww  w.  j  a va2  s .  co m*/
        return truncateData;
    }
}

Related

  1. truncateBodyText(String input)
  2. truncateByCharLength(String string, int maxLength)
  3. truncateByCharLengthWithEllipsis(String string, int maxLength)
  4. truncateCellValue(String x, int maxChars)
  5. truncateCodeStringIfNeeded(String codeString)
  6. truncateDatabaseName(String db)
  7. truncatedStr(String s, int maxLength)
  8. truncateExtension(String name)
  9. truncateFileName(String agent, String s)