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

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

Introduction

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

Prototype

public static String remove(final String str, final char remove) 

Source Link

Document

Removes all occurrences of a character from within the source string.

A null source string will return null .

Usage

From source file:com.commander4j.db.JDBPrinters.java

public void setPaperSize(String size) {
    String result = JUtility.replaceNullStringwithBlank(size).toLowerCase();
    dbPaperSize = StringUtils.remove(result, " ");
}

From source file:de.ks.text.AsciiDocParser.java

private String removeFontLink(String render) {
    return StringUtils.remove(render, fontlink);
}

From source file:com.commander4j.db.JDBPrinters.java

public String getPaperSize() {
    String result = JUtility.replaceNullStringwithBlank(dbPaperSize).toLowerCase();
    result = StringUtils.remove(result, " ");
    return result;
}

From source file:com.kylinolap.job.JobInstanceBuilder.java

private String formatPaths(String[] paths) {
    String retVal = ArrayUtils.toString(paths);
    retVal = StringUtils.remove(retVal, "{");
    retVal = StringUtils.remove(retVal, "}");
    return retVal;
}

From source file:com.thinkbiganalytics.metadata.modeshape.support.JcrPropertyUtil.java

private static <T> T readJsonValue(String name, Class<T> type, String json) {
    try {/*  w  w w.  j a  va2s  . c o  m*/
        return reader.forType(type).readValue(json);
    } catch (IOException e) {
        if (ExceptionUtils.getRootCause(e) instanceof ClassNotFoundException) {
            //attempt to find the old class name and replace it with the new one
            ClassNotFoundException classNotFoundException = (ClassNotFoundException) ExceptionUtils
                    .getRootCause(e);
            String msg = classNotFoundException.getMessage();
            msg = StringUtils.remove(msg, "java.lang.ClassNotFound:");
            String oldName = StringUtils.trim(msg);
            try {
                Class newName = ClassNameChangeRegistry.findClass(oldName);
                String newNameString = newName.getName();
                if (StringUtils.contains(json, oldName)) {
                    //replace and try again
                    json = StringUtils.replace(json, oldName, newNameString);
                    return readJsonValue(name, type, json);
                }
            } catch (ClassNotFoundException c) {

            }

        }
        throw new MetadataRepositoryException("Failed to deserialize JSON property: " + name, e);
    }
}

From source file:ch.cyberduck.core.s3.RequestEntityRestStorageService.java

@Override
public void authorizeHttpRequest(final HttpUriRequest httpMethod, final HttpContext context,
        final String forceRequestSignatureVersion) throws ServiceException {
    if (forceRequestSignatureVersion != null) {
        final S3Protocol.AuthenticationHeaderSignatureVersion authenticationHeaderSignatureVersion = S3Protocol.AuthenticationHeaderSignatureVersion
                .valueOf(StringUtils.remove(forceRequestSignatureVersion, "-"));
        log.warn(/*from www . j a  va2  s  .co m*/
                String.format("Switched authentication signature version to %s", forceRequestSignatureVersion));
        session.setSignatureVersion(authenticationHeaderSignatureVersion);
    }
    if (session.authorize(httpMethod, this.getProviderCredentials())) {
        return;
    }
    super.authorizeHttpRequest(httpMethod, context, forceRequestSignatureVersion);
}

From source file:de.crowdcode.kissmda.core.jdt.JdtHelper.java

/**
 * Get JDT ParameterizedType for the given type name.
 * //from  w  ww. j ava2s . c  om
 * @param ast
 *            JDT AST tree
 * @param typeName
 *            input type name
 * @return JDT ParameterizedType
 */
@SuppressWarnings("unchecked")
public ParameterizedType getAstParameterizedType(AST ast, String typeName) {
    // Get the component type and parameters <Type, Type, ...>
    String componentTypeName = StringUtils.substringBefore(typeName, "<");
    Type componentType = getAstSimpleType(ast, componentTypeName);
    ParameterizedType parameterizedType = ast.newParameterizedType(componentType);

    String paramTypeNames = StringUtils.substringAfter(typeName, "<");
    paramTypeNames = StringUtils.removeEnd(paramTypeNames, ">");
    // Result: String, Integer, List<Boolean>, de.test.Company
    String[] parametersAsString = StringUtils.split(paramTypeNames, ",");
    for (int index = 0; index < parametersAsString.length; index++) {
        String paramTypeName = parametersAsString[index];

        paramTypeName = StringUtils.remove(paramTypeName, ",");
        paramTypeName = StringUtils.trim(paramTypeName);

        Type paramType = getChosenType(ast, paramTypeName, paramTypeName, "");

        // Add the type arguments
        parameterizedType.typeArguments().add(paramType);
    }

    return parameterizedType;
}

From source file:com.jspxcms.core.setup.SetupServlet.java

private void copyFile(ServletRequest request, String host, String port, String name, String user,
        String password) throws IOException {
    String customPath = getServletContext().getRealPath("/WEB-INF/classes/custom.properties");
    File customFile = new File(customPath);
    String customString = FileUtils.readFileToString(customFile, "utf-8");
    customString = StringUtils.replace(customString, "{host}", host);
    if (StringUtils.isNotBlank(port)) {
        customString = StringUtils.replace(customString, "{port}", port);
    } else {/*from w  w  w .j  a va 2  s.c  o  m*/
        customString = StringUtils.remove(customString, ":{port}");
    }
    customString = StringUtils.replace(customString, "{name}", name);
    customString = StringUtils.replace(customString, "{user}", user);
    customString = StringUtils.replace(customString, "{password}", password);
    String destCustomPath = getServletContext().getRealPath("/WEB-INF/classes/custom.properties");
    FileUtils.write(new File(destCustomPath), customString, "utf-8");

    String webPath = getServletContext().getRealPath("/setup/file/web.xml");
    String destWebPath = getServletContext().getRealPath("/WEB-INF/web.xml");
    FileUtils.copyFile(new File(webPath), new File(destWebPath));
}

From source file:com.tlabs.android.jeeves.views.EveFormat.java

private static String cleanHTML(final String html) {
    String r = StringUtils.isBlank(html) ? "" : html.trim();
    if (r.isEmpty()) {
        return r;
    }/*from   w ww  .ja v a  2s .co m*/

    r = StringUtils.remove(html, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");

    //remove ALL the font tags
    //@see http://blogs.msdn.com/b/ericgu/archive/2006/01/30/519462.aspx
    r = r.replaceAll("<font(\\s|\\r|\\n).*?>", "");
    r = r.replaceAll("</?font[^>]*>", "");

    //r = StringUtils.replace(r, "\n", "<br/>\n");
    r = StringUtils.replace(r, "<br>", "<br/>");
    r = StringUtils.remove(r, "shellexec:");
    //is it the shellexec or me or some people can't type?      
    r = StringUtils.replace(r, "http://http://", "http://");
    r = StringUtils.replace(r, "https://https://", "https://");

    return r;
}

From source file:cgeo.geocaching.connector.AbstractConnector.java

public String getShortHost() {
    return StringUtils.remove(getHost(), "www.");
}