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

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

Introduction

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

Prototype

public static String replaceChars(final String str, final String searchChars, String replaceChars) 

Source Link

Document

Replaces multiple characters in a String in one go.

Usage

From source file:com.emergya.persistenceGeo.utils.GeoserverUtils.java

public static String generateName(String name) {
    String workspaceName = name;// w ww . j a  v  a  2  s.c  om
    workspaceName = StringUtils.replaceChars(workspaceName, ".- \t", "____");
    workspaceName = StringUtils.lowerCase(workspaceName);
    workspaceName = StringUtils.replaceChars(workspaceName, "''\"",
            "aeiounaeiouu___");
    return workspaceName;
}

From source file:com.github.riccardove.easyjasub.commons.CommonsLangStringUtils.java

public static String replaceChars(String str, String searchChars, String replaceChars) {
    return StringUtils.replaceChars(str, searchChars, replaceChars);
}

From source file:ctrus.pa.bow.term.transformation.ChunkTransformer.java

@Override
public String transform(String term) {
    String chunckTerms = term;//  w w w . jav a2s.c  om
    for (Character c : _chunkChars) {
        chunckTerms = StringUtils.replaceChars(chunckTerms, c, ' ');
    }
    // Remove multiple spaces with single space before returning
    return chunckTerms.replaceAll("\\s+", " ");
}

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

public String process(String str, String searchChars, String replaceChars) {
    return StringUtils.replaceChars(str, searchChars, replaceChars);
}

From source file:hu.bme.mit.sette.common.util.JavaFileUtils.java

/**
 * Converts a filename to a Java package name by transliterating the file
 * separator characters to the package separator character.
 *
 * @param filename/*ww  w.  java2 s. c  o  m*/
 *            The filename (e.g. hu/bme/mit/sette)
 * @return The package name (e.g. hu.bme.mit.sette)
 */
public static String filenameToPackageName(final String filename) {
    return StringUtils.replaceChars(filename, File.separatorChar, JavaFileUtils.PACKAGE_SEPARATOR);
}

From source file:com.oncore.calorders.rest.service.helper.ContactHelper.java

public static String stripPhonePunctuation(String phone) {
    if (phone != null) {
        phone = StringUtils.replaceChars(phone, " ()-", "");
    }//from w  w  w.  jav a2 s  .  co m
    return phone;
}

From source file:annis.gui.beans.HistoryEntry.java

@Override
public String toString() {
    return StringUtils.replaceChars(query, "\r\n", "  ");
}

From source file:com.sangupta.shire.util.ShireUtils.java

public static String normalizePathOrUrl(String path) {
    return StringUtils.replaceChars(path, NORMALIZATION_CHARS, "_");
}

From source file:com.textocat.textokit.morph.opencorpora.resource.YoLemmaPostProcessor.java

/**
 * {@inheritDoc}//from w w  w.  j av a2 s.c  o  m
 */
@Override
public boolean process(MorphDictionary dict, Lemma.Builder lemmaBuilder, Multimap<String, Wordform> wfMap) {
    Multimap<String, Wordform> additionalWfs = LinkedHashMultimap.create();
    for (String wfStr : wfMap.keySet()) {
        // alternative wordform string
        String altStr = StringUtils.replaceChars(wfStr, YO_CHARS, YO_REPLACEMENTS);
        if (Objects.equal(wfStr, altStr)) {
            continue;
        } // else wfStr contains 'yo'
        if (wfMap.containsKey(altStr)) {
            // the wordform multimap already contains string without 'yo'
            continue;
        }
        additionalWfs.putAll(altStr, wfMap.get(wfStr));
    }
    wfMap.putAll(additionalWfs);
    return true;
}

From source file:hu.bme.mit.sette.common.util.JavaFileUtils.java

/**
 * Converts a Java package name to filename by transliterating the package
 * separator characters to the file separator charater.
 *
 * @param packageName//from w w  w  .  j  a v  a  2  s. com
 *            The package name (e.g. hu.bme.mit.sette)
 * @return The filename (e.g. hu/bme/mit/sette)
 */
public static String packageNameToFilename(final String packageName) {
    return StringUtils.replaceChars(packageName, JavaFileUtils.PACKAGE_SEPARATOR, File.separatorChar);
}