Here you can find the source of abbreviation(String description)
description
, returns description
if its length is no greater than 10, or description
+ "..."
public static String abbreviation(String description)
//package com.java2s; public class Main { /**//from w w w . j a v a2s.c o m * Given a string <code>description</code>, returns <code>description</code> * if its length is no greater than 10, or <code>description</code> + "..." * otherwise. */ public static String abbreviation(String description) { return "\"" + description.substring(0, Math.min(10, description.length())) + (description.length() > 10 ? "(...)" : "") + "\""; } }