Java String Truncate truncate(String eval, String suffix, int targetLength)

Here you can find the source of truncate(String eval, String suffix, int targetLength)

Description

truncate

License

Apache License

Declaration

public static String truncate(String eval, String suffix, int targetLength) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String truncate(String eval, String suffix, int targetLength) {
        if (eval.length() > targetLength)
            return eval.substring(0, targetLength - 1) + suffix;
        else/*from www. j av a 2  s  .c  om*/
            return eval;
    }
}

Related

  1. truncate(final String str, final int len)
  2. truncate(final String str, final int maxWidth)
  3. truncate(final String target, final int maxSize)
  4. truncate(final String value, final int width)
  5. truncate(Object truncateMe, int maxLength, String suffix)
  6. truncate(String input, int maxLength)
  7. truncate(String input, int maxLength)
  8. truncate(String input, int size)
  9. truncate(String message)