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

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

Introduction

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

Prototype

public static String remove(String str, char remove) 

Source Link

Document

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

Usage

From source file:com.ctc.storefront.web.mvc.AcceleratorUrlPathHelper.java

@Override
public String getContextPath(final HttpServletRequest request) {
    final Object urlEncodingAttributes = request.getAttribute(WebConstants.URL_ENCODING_ATTRIBUTES);
    return StringUtils.remove(super.getContextPath(request),
            urlEncodingAttributes != null ? urlEncodingAttributes.toString() : "");
}

From source file:net.sf.zekr.engine.search.SearchUtils.java

/**
 * This method removes specific diacritics form the string, and also replaces Hamza characters with their
 * base character. It also replaces <tt>ARABIC_LETTER_TEH_MATBUTA</tt> with <tt>ARABIC_LETTER_TEH</tt>, and
 * <tt>ARABIC_LETTER_ALEF_MAKSURA</tt> with <tt>ARABIC_LETTER_YEH</tt>.
 * /*w w  w . ja v  a 2 s.  com*/
 * @param str string to be simplified
 * @return simplified form of the <code>str</code>
 */
public static String arabicSimplify4AdvancedSearch(String str) {
    // diacritics removal
    char[] arr = new char[] { SUKUN, SHADDA, KASRA, DAMMA, FATHA, KASRATAN, DAMMATAN, FATHATAN,
            SUPERSCRIPT_ALEF };
    for (int i = 0; i < arr.length; i++) {
        str = StringUtils.remove(str, arr[i]);
    }

    // YEH, ALEF, WAW, TEH replacements
    str = str.replace(ALEF_HAMZA_ABOVE, ALEF);
    str = str.replace(ALEF_HAMZA_BELOW, ALEF);
    str = str.replace(WAW_HAMZA_ABOVE, WAW);
    str = str.replace(YEH_HAMZA_ABOVE, ARABIC_YEH);
    str = str.replace(ALEF_MAKSURA, ARABIC_YEH);
    str = str.replace(TEH_MARBUTA, TEH);

    return str;
}

From source file:com.acc.storefront.web.wrappers.UrlEncodeHttpRequestWrapper.java

@Override
public String getRequestURI() {
    final String originalRequestURI = super.getRequestURI();
    final String tempRequestURI = StringUtils.remove(originalRequestURI, super.getContextPath());

    if (StringUtils.isEmpty(tempRequestURI) || StringUtils.containsOnly(tempRequestURI, "/")) {
        return "/";
    }//from www.  j  ava  2  s  .c  o m
    return originalRequestURI;
}

From source file:fr.norad.visuwall.plugin.jenkins.JenkinsVersionPage.java

private void addWarnings(SoftwareId softwareInfo, String strVersion) {
    String cleanedVersion = StringUtils.remove(strVersion, ".");
    if (isNumeric(cleanedVersion)) {
        double version = Double.parseDouble(strVersion);
        if (version < 1.405) {
            addWarningForVersionBefore1405(softwareInfo);
        }// ww  w.j ava  2  s .  co  m
    }
}

From source file:com.github.jarscanner.DirectoryScanner.java

public List<File> scanFiles(String dirName) throws IOException {
    List<File> result = new ArrayList<File>();
    File file = new File(dirName);
    LOG.info("Scan folder - " + dirName);
    String addDirName = StringUtils.remove(file.getAbsolutePath().replace("\\", "/"), dirName).replaceFirst(".",
            "");/*www  . ja  v  a 2 s  .  c o m*/
    if (file.isDirectory()) {
        Collection<File> filesInDir = FileUtils.listFiles(file, FileFileFilter.FILE, null);
        if (!filesInDir.isEmpty()) {
            for (File file2 : filesInDir) {
                result.add(file2);
            }
        }
    }
    return result;
}

From source file:ml.shifu.shifu.core.LR.java

public static LR loadFromString(String input) {
    String target = StringUtils.remove(StringUtils.remove(input, '['), ']');
    String[] ws = target.split(",");
    double[] weights = new double[ws.length];
    int index = 0;
    for (String weight : ws) {
        weights[index++] = Double.parseDouble(weight);
    }//from w ww . jav a2s  .c  o  m
    return new LR(weights);
}

From source file:com.mmounirou.spotirss.provider.Billboard.java

@Override
@Nullable// ww w  .  j  a  v  a 2  s.c  o m
public Track apply(@Nullable String strTitle) {
    int rankPos = strTitle.indexOf(":");
    String strRank = strTitle.substring(0, rankPos);

    String strArtistName = strTitle.substring(rankPos + 1);
    String strDefaultTitle = strArtistName.substring(0, strArtistName.lastIndexOf(","));
    String strDefaultArtist = strArtistName.substring(strArtistName.lastIndexOf(",") + 1);

    String strSong = StringUtils.remove(strDefaultTitle,
            String.format("(%s)", StringUtils.substringBetween(strDefaultTitle, "(", ")")));
    String strArtist = strDefaultArtist;

    final Set<String> artistNames = StringTools.split(strArtist,
            new String[] { "Featuring", "Feat\\.", "feat\\.", "&", "," });

    return new Track(Integer.parseInt(strRank), artistNames, strSong);

}

From source file:com.navigation.AbstractViewNavigator.java

public Class resolveViewConfig(String path) {
    if (Strings.isNullOrEmpty(path)) {
        return null;
    }//from w ww  .j a v a2  s  .  c  o m
    String checkPath = null;
    if (path.contains("?faces-redirect=true")) {
        checkPath = StringUtils.remove(path, "?faces-redirect=true");
    } else {
        checkPath = path;
    }
    ConfigDescriptor descriptor = viewConfigResolver.getConfigDescriptor(checkPath);
    if (descriptor == null) {
        return null;
    }
    return descriptor.getConfigClass();
}

From source file:com.mmounirou.spotirss.provider.Apple.java

@Override
@Nullable/*from w  ww  . j av  a2 s . com*/
public Track apply(@Nullable String strTitle) {
    int rankPos = strTitle.indexOf(".");
    String strRank = strTitle.substring(0, rankPos);

    String strArtistAndSong = strTitle.substring(rankPos + 1);

    String strTempSong = strArtistAndSong.substring(0, strArtistAndSong.lastIndexOf(" - "));
    String strTempArtist = strArtistAndSong.substring(strArtistAndSong.lastIndexOf(" - ") + 2);

    String strSong = strTempSong;

    strSong = StringUtils.remove(strSong,
            String.format("(%s)", StringUtils.substringBetween(strSong, "(", ")")));
    strSong = StringUtils.remove(strSong,
            String.format("[%s]", StringUtils.substringBetween(strSong, "[", "]")));

    String strArtist = strTempArtist;
    String strfeaturing = StringUtils.trimToEmpty(StringUtils.substringBetween(strTempSong, "(", ")"));
    if (strfeaturing.contains("feat.")) {
        strArtist = strArtist + " " + strfeaturing;
    }

    strfeaturing = StringUtils.trimToEmpty(StringUtils.substringBetween(strTempSong, "[", "]"));
    if (strfeaturing.contains("feat.")) {
        strArtist = strArtist + " " + strfeaturing;
    }

    final Set<String> artistNames = StringTools.split(strArtist,
            new String[] { "Featuring", "Feat\\.", "feat\\.", "&", "," });

    return new Track(Integer.parseInt(strRank), artistNames, strSong);

}

From source file:de.erdesignerng.test.BaseERDesignerTestCaseImpl.java

protected boolean compareStrings(String aString1, String aString2) {
    aString1 = StringUtils.remove(aString1, (char) 13);
    aString1 = StringUtils.remove(aString1, (char) 10);

    aString2 = StringUtils.remove(aString2, (char) 13);
    aString2 = StringUtils.remove(aString2, (char) 10);

    System.out.println(aString1 + "\n" + aString1.length());
    System.out.println(aString2 + "\n" + aString2.length());

    return aString1.equals(aString2);
}