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:jetbrick.tools.chm.model.ClassInfo.java

public String getPackageName() {
    return StringUtils.remove(this.fullName, "." + this.shortName);
}

From source file:cec.easyshop.storefront.web.wrappers.UrlEncodeHttpRequestWrapper.java

@Override
public String getRequestURI() {
    final String originalRequestURI = super.getRequestURI();
    final String originalContextPath = super.getContextPath();
    final String contextPath = this.getContextPath();
    final String originalRequestUriMinusAnyContextPath;

    if (StringUtils.startsWith(originalRequestURI, contextPath)) {
        originalRequestUriMinusAnyContextPath = StringUtils.remove(originalRequestURI, contextPath);
    } else if (StringUtils.startsWith(originalRequestURI, originalContextPath)) {
        originalRequestUriMinusAnyContextPath = StringUtils.remove(originalRequestURI, originalContextPath);
    } else {//from  www . jav  a  2  s.c o m
        originalRequestUriMinusAnyContextPath = originalRequestURI;
    }

    return getContextPath() + originalRequestUriMinusAnyContextPath;
}

From source file:cz.muni.fi.lessappcache.filters.FilterClassLoader.java

private String resolveName(String name) {
    char[] delimiter = { '-' };
    return "cz.muni.fi.lessappcache.filters."
            + StringUtils.remove(WordUtils.capitalizeFully(name.substring(1), delimiter), "-") + "Filter";
}

From source file:net.sf.zekr.common.resource.filter.QuranWriterFilter.java

public String filter(QuranFilterContext qfc) {
    String str = qfc.text;//w  w w .  j av  a2  s. c  om

    boolean suppressFilter = ApplicationConfig.getInstance().getProps().getBoolean("text.filter.suppress",
            false);
    if (suppressFilter) {
        return str;
    }

    if (qfc.ayaNum == 1 && qfc.suraNum != 1 && qfc.suraNum != 9) {
        int sp = -1;
        for (int i = 0; i < 4; i++) { // ignore 4 whitespaces.
            sp = str.indexOf(' ', sp + 1);
        }
        str = str.substring(sp + 1);
    }

    // remove SAJDA and HIZB sign
    str = StringUtils.remove(str, " " + SAJDA_PLACE);
    str = StringUtils.remove(str, RUB_EL_HIZB + " ");

    // good for Uthmani text
    if ((qfc.params & UTHMANI_TEXT) == UTHMANI_TEXT) {
        str = RegexUtils.pregReplace(str, "($SHADDA|$FATHA)($SUPERSCRIPT_ALEF)", "$1$TATWEEL$2");
        str = RegexUtils.pregReplace(str, "([$HAMZA$DAL-$ZAIN$WAW][$SHADDA$FATHA]*)$TATWEEL($SUPERSCRIPT_ALEF)",
                "$1$ZWNJ$2");
    }
    str = RegexUtils.pregReplace(str, "($SHADDA)([$KASRA$KASRATAN])", "$2$1");

    str = StringUtils.replace(str, String.valueOf(ALEF) + MADDA, String.valueOf(ALEF_MADDA));

    if ((qfc.params & SHOW_WAQF_SIGN) != SHOW_WAQF_SIGN) {
        // remove all waqf signs
        str = highlightRegex.matcher(str).replaceAll("");
    }

    if ((qfc.params & HIGHLIGHT_WAQF_SIGN) == HIGHLIGHT_WAQF_SIGN) {
        // highlight waqf sign
        if (ApplicationConfig.getInstance().getProps().getBoolean("text.filter.noSpaceBeforeWaqf", false)) {
            str = highlightRegex.matcher(str).replaceAll(REPLACE_HIGHLIGHT_NOSPACE);
        } else {
            str = highlightRegex.matcher(str).replaceAll(REPLACE_HIGHLIGHT);
        }
    }
    return str;
}

From source file:jetbrick.tools.chm.reader.IndexesReader.java

private void addIndex(Map<String, String> indexMaps, String text, String url) throws FileNotFoundException {
    String key;/*from  w w w  . ja  va  2s .c om*/
    String urlToUse = url;
    urlToUse = StringUtils.remove(urlToUse, "../");
    urlToUse = StringUtils.remove(urlToUse, "./");

    if (url.indexOf('#') < 0) {
        key = text + " class";
    } else {
        key = StringUtils.substringBefore(text, "(");
        if (text.indexOf('(') != -1) {
            key = key + "()";
        }

        String textToUse = StringUtils.substringBefore(urlToUse, ".html");
        textToUse = textToUse.replace('/', '.') + "." + text;
        KeyManager keyManager = keyManagerMaps.get(key);
        String urlRedir = "../" + urlToUse;
        if (keyManager == null) {
            keyManager = new KeyManager(key);
            keyManager.add(textToUse, AnchorNameManager.replaceAnchor(urlRedir));
            keyManagerMaps.put(key, keyManager);
        } else { // repeat
            keyManager.add(textToUse, AnchorNameManager.replaceAnchor(urlRedir));
            // redirect
            urlToUse = keyManager.getUrl();
        }
    }
    indexMaps.put(key, AnchorNameManager.replaceAnchor(urlToUse));
}

From source file:de.hybris.platform.acceleratorfacades.device.populators.ResponsiveImagePopulator.java

@Override
public void populate(final MediaModel mediaModel, final ImageData imageData) throws ConversionException {
    final Matcher filenameMatcher = fileNameExtractorPattern.matcher(mediaModel.getCode());
    if (filenameMatcher.find()) {
        final Matcher widthMatcher = widthExtractorPattern.matcher(filenameMatcher.group());
        if (widthMatcher.find()) {
            final String matchingString = StringUtils.uncapitalize(widthMatcher.group());
            imageData.setWidth(Integer.valueOf(StringUtils.remove(matchingString, 'x')));
        }/*ww  w .jav a 2 s. co m*/
    } else {
        if (getResponsiveImageFormats().containsKey(mediaModel.getMediaFormat().getQualifier())) {
            imageData.setWidth(getResponsiveImageFormats().get(mediaModel.getMediaFormat().getQualifier()));
        }
    }
}

From source file:at.pagu.soldockr.repository.cdi.SolrTemplateProducer.java

private SolrServer getSolrServerInstance() throws IOException, ParserConfigurationException, SAXException {
    System.setProperty("solr.solr.home",
            StringUtils.remove(ResourceUtils.getURL("classpath:at/pagu/soldockr").toString(), "file:/"));
    CoreContainer.Initializer initializer = new CoreContainer.Initializer();
    CoreContainer coreContainer = initializer.initialize();
    return new EmbeddedSolrServer(coreContainer, "");
}

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

public static String simplifyAdvancedSearchQuery(String query) {
    // diacritics removal
    // TODO: sala, ghala, ...
    char[] arr = new char[] { SMALL_LOW_SEEN, SMALL_HIGH_MEEM, SMALL_WAW, SMALL_YEH, MADDAH_ABOVE,
            SMALL_ROUNDED_ZERO };/*from w  ww. j a v a  2 s.c o m*/
    for (int i = 0; i < arr.length; i++) {
        query = StringUtils.remove(query, arr[i]);
    }

    query = query.replaceAll("" + TATWEEL + SUPERSCRIPT_ALEF, "" + ALEF);
    query = query.replaceAll("" + ALEF_MAKSURA + HAMZA_BELOW, "" + YEH_HAMZA_ABOVE);
    query = query.replace(ARABIC_QUESION_MARK, '?');
    query = query.replace(ALEF_WASLA, ALEF);
    return replaceLayoutSimilarCharacters(arabicSimplify4AdvancedSearch(query));
}

From source file:com.tlabs.eve.api.server.MessageOfTheDayParser.java

public MessageOfTheDayResponse parse(byte[] data) throws IOException {
    final int CACHE_IN_MN = /*60 * 8*/5;
    MessageOfTheDayResponse response = new MessageOfTheDayResponse();
    long now = System.currentTimeMillis();
    response.setCachedUntil(now - TimeZone.getDefault().getOffset(now) + CACHE_IN_MN * 60 * 1000);

    String message = new String(data);
    if (message.length() == 0) {
        //keep a content otherwise caching won't occur when the received data is empty
        message = "<br/>";
    } else {/*from w  w w .ja  va  2 s . c  om*/
        //The content is not great...we have a MOTD at start (sometimes)
        //or a <center>MOTD</center> or anything with such form
        //Also CCP found it funny to add shellexec: in front of <a> URLs.
        //A real XML would have been great.
        message = StringUtils.removeStart(message, "MOTD");
        message = StringUtils.remove(message, "shellexec:");
        message = StringUtils.replace(message, "<br>", "<br/>");
    }
    response.setMessage(message);
    return response;
}

From source file:com.linkedin.pinot.core.segment.index.readers.StringDictionary.java

@Override
public String get(int dictionaryId) {
    if ((dictionaryId == -1) || (dictionaryId >= length())) {
        return "null";
    }/*w w w .j a  v  a  2  s.  com*/
    return StringUtils.remove(getString(dictionaryId), String.valueOf(V1Constants.Str.STRING_PAD_CHAR));
}