Example usage for org.apache.commons.lang StringUtils chop

List of usage examples for org.apache.commons.lang StringUtils chop

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils chop.

Prototype

public static String chop(String str) 

Source Link

Document

Remove the last character from a String.

Usage

From source file:StringUtilsExampleV1.java

public static void main(String args[]) {
    System.err.println(StringUtils.chop("Dane"));
}

From source file:com.rslakra.java.string.TestApacheStringUtils.java

public static void main(String args[]) {

    System.err.println(StringUtils.abbreviate("Take time off working", 0, 10));
    System.err.println(StringUtils.capitalize("vanderLust"));
    System.err.println(StringUtils.center("MTV", 7, '='));
    System.err.println(StringUtils.chomp("temperature", "ure"));
    System.err.println(StringUtils.chop("Dane"));
    System.err.println(StringUtils.contains("Dorothy", "oro"));
    System.err.println(StringUtils.containsNone("r u m t", new char[] { 'r', 'o' }));
    System.err.println(StringUtils.containsOnly("r u m t", new char[] { 'r', 'o' }));
    System.err.println(StringUtils.countMatches("arthur", "r"));
    System.err.println(StringUtils.deleteWhitespace("f f f f"));
    System.err.println(StringUtils.difference("govern", "government"));
    System.err.println(StringUtils.getLevenshteinDistance("govern", "government"));

}

From source file:com.ning.hfind.primary.SizePrimary.java

public SizePrimary(String size) {
    if (StringUtils.endsWith(size, SIZE_CHARACTER)) {
        blockMode = false;//from   w  w w .j  ava  2s  .  com
        size = StringUtils.chop(size);
    }

    operandModifier = new OperandModifier(size);
    this.size = operandModifier.getSanitizedArgument();
}

From source file:com.hortonworks.registries.storage.impl.jdbc.provider.sql.query.AbstractSqlQuery.java

/**
 * @param num number of times to repeat the pattern
 * @return bind variables repeated num times
 *//*from   w  w w  . j a  v  a 2 s.c o  m*/
protected String getBindVariables(String pattern, int num) {
    return StringUtils.chop(StringUtils.repeat(pattern, num));
}

From source file:net.sf.firemox.database.data.TranslatedCollectionData.java

@Override
public String getTranslatedValue(Proxy proxy) {
    if (translatedValue == null) {
        StringBuilder res = new StringBuilder(values.length * 20);
        for (String value : values) {
            if (res.length() != 0) {
                res.append(", ");
            }/*from  w  w w. jav a  2 s .co  m*/
            if (proxy == null) {
                res.append(
                        LanguageManagerMDB.getString(StringUtils.chop(getPropertyName()) + "-" + value.trim()));
            } else {
                res.append(LanguageManagerMDB.getString(StringUtils.chop(getPropertyName()) + "-"
                        + proxy.getGlobalValueFromLocal(StringUtils.chop(getPropertyName()), value.trim())));
            }
        }
        translatedValue = res.toString();
    }
    return translatedValue;
}

From source file:biz.netcentric.cq.tools.actool.authorizableutils.AuthorizableConfigBean.java

public String getMemberOfString() {
    if (memberOf == null) {
        return "";
    }//w ww .  j a v a  2  s.  co m

    final StringBuilder memberOfString = new StringBuilder();

    for (final String group : memberOf) {
        memberOfString.append(group).append(",");
    }
    return StringUtils.chop(memberOfString.toString());
}

From source file:biz.netcentric.cq.tools.actool.helper.AceWrapper.java

public String getPrivilegesString() {
    final Privilege[] privileges = this.ace.getPrivileges();
    String privilegesString = "";
    for (final Privilege privilege : privileges) {
        privilegesString = privilegesString + privilege.getName() + ",";
    }//from   w  w w. j a v a2 s  .c  o  m
    privilegesString = StringUtils.chop(privilegesString);
    return privilegesString;
}

From source file:chh.utils.db.source.common.JdbcClient.java

private String constructInsertQuery(String tableName, List<List<Column>> columnLists) {
    StringBuilder sb = new StringBuilder();
    sb.append("Insert into ").append(tableName).append(" (");
    Collection<String> columnNames = Collections2.transform(columnLists.get(0), new Function<Column, String>() {
        @Override/*from  w  w w .j ava  2 s.  c  om*/
        public String apply(Column input) {
            return input.getColumnName();
        }
    });
    String columns = Joiner.on(",").join(columnNames);
    sb.append(columns).append(") values ( ");

    String placeHolders = StringUtils.chop(StringUtils.repeat("?,", columnNames.size()));
    sb.append(placeHolders).append(")");

    return sb.toString();
}

From source file:biz.netcentric.cq.tools.actool.authorizableutils.AuthorizableConfigBean.java

public String getMembersString() {
    if (members == null) {
        return "";
    }//from  w  ww  .  ja va 2 s.  c o  m

    final StringBuilder membersString = new StringBuilder();

    for (final String group : members) {
        membersString.append(group).append(",");
    }
    return StringUtils.chop(membersString.toString());
}

From source file:com.flexive.shared.FxDropApplication.java

/**
 * Create a new application descriptor.//from  w  w w  .  j a v a 2  s .c om
 *
 * @param name              the unique name of the application
 * @param contextRoot       the context root of the web application
 * @param displayName       a human-readable name of the application
 * @param resourceURL       the URL that was used for loading flexive-application.properties
 * @since 3.1
 */
public FxDropApplication(String name, String contextRoot, String displayName, URL resourceURL) {
    checkParameterEmpty(name, "name");
    checkParameterEmpty(displayName, "displayName");
    this.name = name;
    this.contextRoot = contextRoot;
    this.displayName = displayName;

    if (resourceURL == null) {
        this.resourceURL = null;
        this.isJarProtocol = false;
    } else {
        // set base url
        String path = resourceURL.getPath().replace("/" + FxSharedUtils.FLEXIVE_DROP_PROPERTIES, "");
        if (path.endsWith("!")) {
            // strip JAR content separator
            path = StringUtils.chop(path);
        }
        this.resourceURL = path;
        this.isJarProtocol = "vfszip".equals(resourceURL.getProtocol())
                || "vfs".equals(resourceURL.getProtocol()) || "jar".equals(resourceURL.getProtocol())
                || resourceURL.getPath().indexOf('!') != -1;
    }
}