Java String Shorten shorten(String name, int max)

Here you can find the source of shorten(String name, int max)

Description

shorten

License

LGPL

Declaration

private static String shorten(String name, int max) 

Method Source Code

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

public class Main {
    private static String shorten(String name, int max) {
        int index = name.indexOf(' ');
        while (name.length() > max && index != -1) {
            name = name.substring(index + 1);
            index = name.indexOf(' ');
        }/*from w  w w . j a v a 2  s  .c o m*/

        return name;
    }
}

Related

  1. shorten(String input)
  2. shorten(String input, int length, boolean wholeWord)
  3. shorten(String label, int maxLength)
  4. shorten(String line)
  5. shorten(String msg, int front, String join, int end)
  6. shorten(String nameForUI, int maxLen)
  7. shorten(String pkg, boolean shorten)
  8. shorten(String s)
  9. shorten(String s)