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

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

Introduction

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

Prototype

public static String strip(final String str) 

Source Link

Document

Strips whitespace from the start and end of a String.

This is similar to #trim(String) but removes whitespace.

Usage

From source file:org.emonocot.api.job.TermFactory.java

public static String normaliseTerm(String term) {
    // no quotes or whitespace in term names
    term = StringUtils.strip(StringUtils.trim(QUOTE_PATTERN.matcher(term).replaceAll("")));
    return term.toLowerCase();
}

From source file:org.komusubi.feeder.model.AbstractScript.java

/**
 * @see org.komusubi.feeder.model.Message.Script#trimedLine()
 */
@Override
public String trimedLine() {
    return StringUtils.strip(line());
}

From source file:org.n52.movingcode.feed.FeedConfig.java

/**
 * Parse line, return array of strings (key,value)
 * //from  w  ww .  jav  a  2  s  .co  m
 * @param line
 * @return
 */
private static final String[] processLine(String line) {

    // strip leading and trailing spaces
    line = StringUtils.trim(line);
    line = StringUtils.strip(line);

    // ignore comments starting with "#"
    if (line.startsWith(comment)) {
        // skip line
        return null;
    }

    // check no of occurences of "="
    if (StringUtils.countMatches(line, separator) < 1) {
        // skip line
        return null;
    }

    // extract key / value and strip leading and trailing spaces
    int sepIndex = line.indexOf(separator);

    String key = line.substring(0, sepIndex - 1);
    key = StringUtils.trim(key);
    //key = StringUtils.strip(key);

    String value = line.substring(sepIndex + 1);
    value = StringUtils.trim(value);

    return new String[] { key, value };
}

From source file:org.rippleosi.search.reports.graph.search.ReportGraphQueryStrategy.java

@Override
public UriComponents getQueryUriComponents() {
    // TODO - use graphQuery and remove hard coded ehrID, and introduce template lookup
    return UriComponentsBuilder.fromHttpUrl(c4hOpenEHRAddress + "/view")
            .path("/4ee4bad9-2f9e-4e33-b1d6-6572709cabee" + "/ProblemAgeBands")
            .queryParam("targetCompositions", "Problem list")
            .queryParam("targetTextValues", StringUtils.strip(graphQuery.getSearchString())).build();
}

From source file:org.rippleosi.search.reports.table.search.ReportTableQueryStrategy.java

public Map<String, String> getUriVariables() {
    Map<String, String> uriVars = new HashMap<>();
    uriVars.put("openEHRTemplate", "{'Problem List'}");
    uriVars.put("searchString", "{'" + StringUtils.strip(tableQuery.getSearchString()) + "'}");
    return uriVars;
}

From source file:org.sejda.impl.sambox.component.split.SplitByTextChangesOutputStrategy.java

String extractTextFromPageArea(PDPage page, TopLeftRectangularBox area) throws TaskIOException {
    String text = new PdfTextExtractorByArea().extractTextFromArea(page, area.asRectangle());
    String result = defaultIfBlank(text, "");
    result = StringUtils.strip(result);
    return result;
}

From source file:org.sleuthkit.autopsy.timeline.db.SQLHelper.java

private static String getSQLWhere(TextFilter filter) {
    if (filter.isActive()) {
        if (StringUtils.isBlank(filter.getText())) {
            return "1";
        }/*from www  .ja v a 2  s  .c  om*/
        String strippedFilterText = StringUtils.strip(filter.getText());
        return "((med_description like '%" + strippedFilterText + "%')" //NON-NLS
                + " or (full_description like '%" + strippedFilterText + "%')" //NON-NLS
                + " or (short_description like '%" + strippedFilterText + "%'))"; //NON-NLS
    } else {
        return "1";
    }
}

From source file:org.sleuthkit.autopsy.timeline.events.db.EventDB.java

private static String getSQLWhere(TextFilter filter) {
    if (filter.isActive()) {
        if (StringUtils.isBlank(filter.getText())) {
            return "1";
        }//from  www  .  ja  v  a  2 s  .  c o m
        String strip = StringUtils.strip(filter.getText());
        return "((" + MED_DESCRIPTION_COLUMN + " like '%" + strip + "%') or (" // NON-NLS
                + FULL_DESCRIPTION_COLUMN + " like '%" + strip + "%') or (" // NON-NLS
                + SHORT_DESCRIPTION_COLUMN + " like '%" + strip + "%'))"; // NON-NLS
    } else {
        return "1";
    }
}

From source file:org.structr.core.Services.java

public String getConfigValue(final Map<String, String> config, final String key, final String defaultValue) {

    String value = StringUtils.strip(config.get(key));

    if (value != null) {
        return value;
    }/*  www  . ja v a2  s . c o m*/

    return defaultValue;
}

From source file:org.structr.javaparser.JavaParserModule.java

private String getMemberName(final String rawName) {
    final String[] parts = StringUtils.split(rawName, " ");
    return StringUtils.strip(StringUtils.remove(parts[parts.length - 1], ";"));
}