StringUtils: abbreviate(String str, int len) : StringUtils « org.apache.commons.lang « Java by API






StringUtils: abbreviate(String str, int len)

/*
1) Abbreviate Once upon a time >>>Once upon... * */

import org.apache.commons.lang.StringUtils;

public class StringUtilsTrial {
  public static void main(String[] args) {
    // String can be max 12 chars including the ...
    System.out.println("1) Abbreviate Once upon a time >>>"
        + StringUtils.abbreviate("Once upon a time ", 12));

  }
}

           
       








Apache-Common-Lang.zip( 248 k)

Related examples in the same category

1.StringUtils: chomp(String str, String separator)
2.StringUtils: containsNone(String str, String invalidChars)
3.StringUtils: containsOnly(String str, String validChars)
4.StringUtils: defaultString(String str)
5.StringUtils: equals(String arg0, String arg1)
6.StringUtils: indexOfDifference(String str1, String str2)
7.StringUtils: join(Object[] array, String separator)
8.StringUtils: reverse(String str)
9.StringUtils: split(String str, String separatorChars)
10.StringUtils: stripToEmpty(String str)
11.StringUtils: substring(String str, int start, int end)
12.StringUtils: trim(String str)
13.StringUtils: trimToEmpty(String str)