Java String Abbreviate abbreviate(String name)

Here you can find the source of abbreviate(String name)

Description

abbreviate

License

Open Source License

Declaration

public static String abbreviate(String name) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String abbreviate(String name) {
        StringBuilder newName = new StringBuilder(name);
        if (name.length() > 14) {
            for (int i = 0; i < (name.length() - 12); i++) {
                newName.deleteCharAt(newName.length() - 1);
            }/*from  w  ww.  j a  v  a 2 s .c o m*/
            newName.append("..");
            return newName.toString();
        }
        return name;
    }
}

Related

  1. abbreviate(String content, int maxWidth, String enc, String suffix)
  2. abbreviate(String fileName, int maxLen)
  3. abbreviate(String input, int length)
  4. abbreviate(String longName)
  5. abbreviate(String longStr, int maxLength)
  6. abbreviate(String s, int length)
  7. abbreviate(String s, int max)
  8. abbreviate(String s, int maxLength)
  9. abbreviate(String src, int maxlen, String replacement)