Example usage for org.apache.commons.lang3 StringUtils abbreviate

List of usage examples for org.apache.commons.lang3 StringUtils abbreviate

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils abbreviate.

Prototype

public static String abbreviate(final String str, int offset, final int maxWidth) 

Source Link

Document

Abbreviates a String using ellipses.

Usage

From source file:com.mycompany.nodesample.MavenMain.java

public String getAbbrevatedString(String str) {
    System.out.println("Result in Java Program = " + StringUtils.abbreviate(str, 0, 10));
    return StringUtils.abbreviate(str, 0, 10);
}

From source file:kenh.expl.functions.Abbreviate.java

public String process(String str, int offset, int maxWidth) {
    return StringUtils.abbreviate(str, offset, maxWidth);
}

From source file:no.kantega.publishing.api.taglibs.util.AbbreviateTag.java

/**
 * Endrer innholde i body//from ww  w.j  av  a  2 s. c om
 * @return
 * @throws JspException
 */
public int doAfterBody() throws JspException {

    text = bodyContent.getString();
    if (text == null) {
        text = "";
    }
    text = StringHelper.stripHtml(text);
    if (text.length() > maxsize) {
        try {
            text = StringUtils.abbreviate(text, leftedge, maxsize);
        } catch (IllegalArgumentException iae) {
            text = "";
        }
    }

    leftedge = 0;
    maxsize = 0;

    return SKIP_BODY;

}

From source file:org.pdfsam.ui.banner.WorkspaceMenuItem.java

WorkspaceMenuItem(String path) {
    requireNotBlank(path, "Workspace item cannot be blank");
    this.setText(StringUtils.abbreviate(path, path.length(), 60));
    this.setOnAction(a -> eventStudio().broadcast(new LoadWorkspaceEvent(new File(path))));
}