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

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

Introduction

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

Prototype

public static String substringBetween(String str, String open, String close) 

Source Link

Document

Gets the String that is nested in between two Strings.

Usage

From source file:se.nrm.dina.user.management.logic.TsvUploader.java

private void readValueFromRow(String[] row) {
    email = StringUtils.substringBetween(row[2], "\"", "\"");
    username = StringUtils.substringBetween(row[3].trim(), "\"", "\"");
    password = StringUtils.substringBetween(row[5].trim(), "\"", "\"");
}

From source file:se.nrm.dina.user.management.utils.CommonString.java

public String getApiVersionValue(String url) {
    String strVersion = StringUtils.substringBetween(url, "/v", "/search");
    return strVersion == null ? "01" : strVersion;
}

From source file:shelper.ifmock.HttpMock.java

public String saveParamLeftstrRightstr(String left, String right) {
    String result = StringUtils.substringBetween(requestedbody, left, right);
    Reporter.log("httpmock?request\n" + left + "\n?" + right
            + "\n" + result, true);
    return result;
}

From source file:uk.ac.ebi.atlas.acceptance.rest.tests.admin.ExperimentAdminControllerIT.java

private int countConditionProperties(String experimentAccession) {
    Response conditionIndexResponse = queryConditionIndex(experimentAccession);

    String responseBody = conditionIndexResponse.body().asString();

    return Integer.parseInt(StringUtils.substringBetween(responseBody, "\"numFound\":", ","));
}

From source file:uk.ac.ebi.atlas.acceptance.selenium.pages.BioEntitiesPage.java

private BaselineBioEntitiesSearchResult buildBaselineEntityCount(WebElement linkElement,
        WebElement countElement, boolean hasSpecies) {

    String linkText = linkElement.getText();
    String linkHref = linkElement.getAttribute("href");

    String species = hasSpecies ? StringUtils.substringBefore(linkText, " - ").trim() : null;
    String experimentName = hasSpecies ? StringUtils.substringAfter(linkText, " - ").trim() : linkText.trim();

    String experimentAccession = StringUtils.substringAfterLast(linkHref, "/");
    experimentAccession = StringUtils.substringBeforeLast(experimentAccession, "?");

    int baselineCount = (countElement == null) ? -1
            : Integer.parseInt(StringUtils.substringBetween(countElement.getText(), "(", ")"));

    return new BaselineBioEntitiesSearchResult(experimentName, species, experimentAccession, baselineCount,
            linkHref);//from  w w w .  j  a v  a  2  s  .  com
}

From source file:util.ui.UiUtilities.java

/**
 * Creates a Html EditorPane that holds a HTML-Help Text.
 *
 * Add a Listener if you want to have clickable Links
 *
 * @param html/*from   w  w  w  .  ja v a  2 s. c om*/
 *          HTML-Text to display
 * @param listener
 *          Link-Listener for this HelpText
 * @param background The color for the background.
 * @return EditorPane that holds a Help Text
 * @since 2.7.2
 */
public static JEditorPane createHtmlHelpTextArea(String html, HyperlinkListener listener, Color background) {
    // Quick "hack". Remove HTML-Code and replace it with Code that includes the
    // correct Font
    if (html.indexOf("<html>") >= 0) {
        html = StringUtils.substringBetween(html, "<html>", "</html>");
    }
    JLabel label = new JLabel();
    Font font = label.getFont();
    html = "<html><div style=\"color:" + UiUtilities.getHTMLColorCode(label.getForeground()) + ";font-family:"
            + font.getName() + "; font-size:" + font.getSize() + ";background-color:rgb(" + background.getRed()
            + "," + background.getGreen() + "," + background.getBlue() + ");\">" + html + "</div></html>";

    final JEditorPane pane = new JEditorPane("text/html", html);
    pane.setBorder(BorderFactory.createEmptyBorder());
    pane.setEditable(false);
    pane.setFont(font);
    pane.setOpaque(false);
    pane.setFocusable(false);

    if (listener != null) {
        pane.addHyperlinkListener(listener);
    }
    return pane;
}