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

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

Introduction

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

Prototype

public static boolean startsWith(final CharSequence str, final CharSequence prefix) 

Source Link

Document

Check if a CharSequence starts with a specified prefix.

null s are handled without exceptions.

Usage

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

public boolean process(String str, String prefix, boolean ignoreCase) {
    if (ignoreCase)
        return StringUtils.startsWithIgnoreCase(str, prefix);
    else//  ww  w  . j a va  2 s.com
        return StringUtils.startsWith(str, prefix);
}

From source file:io.wcm.handler.link.testcontext.DummyMediaSource.java

@Override
public boolean accepts(String mediaRef) {
    return StringUtils.startsWith(mediaRef, "/content/dummymedia/");
}

From source file:com.thinkbiganalytics.security.core.encrypt.EncryptionService.java

public String decrypt(String str) {
    if (StringUtils.isNotBlank(str)) {
        if (StringUtils.startsWith(str, CIPHER_PREFIX)) {
            str = StringUtils.removeStart(str, CIPHER_PREFIX);
        }/*from ww w .jav  a  2  s.  co  m*/
        return encryptor.decrypt(str);
    } else {
        return str;
    }
}

From source file:com.threewks.thundr.view.velocity.VelocityView.java

private String completeViewName(String view) {
    if (!StringUtils.startsWith(view, "/")) {
        view = "/WEB-INF/vm/" + view;
    }/*  w  w  w .j  a va  2s  .  c  o  m*/
    if (!StringUtils.contains(view, ".")) {
        view = view + ".vm";
    }
    return view;
}

From source file:com.atomicleopard.thundr.freemarker.FreemarkerView.java

private String completeViewName(String view) {
    if (!StringUtils.startsWith(view, "/")) {
        view = "/ftl/" + view;
    }//from  w  w w  . j a  va  2s . co m
    if (!StringUtils.contains(view, ".")) {
        view = view + ".ftl";
    }
    return view;
}

From source file:com.threewks.thundr.view.jsp.JspView.java

private String completeViewName(String view) {
    if (!StringUtils.startsWith(view, "/")) {
        view = "/WEB-INF/jsp/" + view;
    }//  w ww  . ja  v a2  s.  c o m
    if (!StringUtils.endsWith(view, ".jsp")) {
        view = view + ".jsp";
    }
    return view;
}

From source file:io.wcm.devops.conga.generator.plugins.fileheader.UnixShellScriptFileHeader.java

@Override
protected int getInsertPosition(String content) {
    // keep shebang on first line if present
    if (StringUtils.startsWith(content, "#!")) {
        return StringUtils.indexOf(content, "\n") + 1;
    }//from w  ww.  ja  v a  2  s.  co m
    return 0;
}

From source file:io.cloudslang.lang.runtime.steps.CloudSlangSequentialExecutionParametersProviderImpl.java

@Override
public Object[] getExecutionParameters() {
    Map<String, Value> execParams = new HashMap<>();
    for (SeqStep step : seqSteps) {
        String args = step.getArgs();
        if (StringUtils.startsWith(args, SEQUENTIAL_PARAMETER)) {
            String paramName = substring(args, SEQUENTIAL_PARAMETER.length(), args.length() - 1)
                    .replaceAll("^\"|\"$", "");
            Value value = currentContext.get(paramName);
            if (value != null) {
                execParams.put(paramName, value);
            }//  w  w w  .j av  a  2 s. c  o m
        }
    }
    // TODO fix get execution from map
    return new Object[] { execParams };
}

From source file:com.threewks.thundr.view.handlebars.HandlebarsView.java

private String completeViewName(String view) {
    if (!StringUtils.startsWith(view, "/")) {
        view = "/WEB-INF/hbs/" + view;
    }//from  ww w.ja v a2  s.  c  o  m
    if (!StringUtils.contains(view, ".")) {
        view = view + ".hbs";
    }
    return view;
}

From source file:com.neophob.sematrix.core.glue.PresetSettings.java

/**
 * Sets the present./*from  w w w  .ja va2s.  c o m*/
 *
 * @param present the new present
 */
public void setPresent(String[] present) {
    List<String> list = new ArrayList<String>();
    for (String s : present) {
        if (StringUtils.startsWith(s, NAME_MARKER)) {
            String rawName = StringUtils.substring(s, NAME_MARKER.length());
            if (StringUtils.isNotBlank(rawName)) {
                this.name = rawName;
            }
        } else {
            list.add(s);
        }
    }
    this.present = list;
}