本文整理了Java中org.apache.commons.lang3.StringUtils.startsWithIgnoreCase()
方法的一些代码示例,展示了StringUtils.startsWithIgnoreCase()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringUtils.startsWithIgnoreCase()
方法的具体详情如下:
包路径:org.apache.commons.lang3.StringUtils
类名称:StringUtils
方法名:startsWithIgnoreCase
[英]Case insensitive check if a CharSequence starts with a specified prefix.
nulls are handled without exceptions. Two nullreferences are considered to be equal. The comparison is case insensitive.
StringUtils.startsWithIgnoreCase(null, null) = true
StringUtils.startsWithIgnoreCase(null, "abc") = false
StringUtils.startsWithIgnoreCase("abcdef", null) = false
StringUtils.startsWithIgnoreCase("abcdef", "abc") = true
StringUtils.startsWithIgnoreCase("ABCDEF", "abc") = true
[中]不区分大小写检查CharSequence是否以指定前缀开头。
空值的处理没有异常。两个空引用被认为是相等的。比较不区分大小写。
StringUtils.startsWithIgnoreCase(null, null) = true
StringUtils.startsWithIgnoreCase(null, "abc") = false
StringUtils.startsWithIgnoreCase("abcdef", null) = false
StringUtils.startsWithIgnoreCase("abcdef", "abc") = true
StringUtils.startsWithIgnoreCase("ABCDEF", "abc") = true
代码示例来源:origin: org.apache.commons/commons-lang3
return str;
if (startsWithIgnoreCase(str, remove)) {
return str.substring(remove.length());
代码示例来源:origin: Graylog2/graylog2-server
@Override
public Boolean evaluate(FunctionArgs args, EvaluationContext context) {
final String value = valueParam.required(args, context);
final String prefix = prefixParam.required(args, context);
final boolean ignoreCase = ignoreCaseParam.optional(args, context).orElse(false);
if (ignoreCase) {
return StringUtils.startsWithIgnoreCase(value, prefix);
} else {
return StringUtils.startsWith(value, prefix);
}
}
代码示例来源:origin: rest-assured/rest-assured
private Closure tryToFindMatchingEncoder(String contentType) {
final Closure closure;
if (contentType == null) {
closure = null;
} else if (StringUtils.startsWithIgnoreCase(contentType, "text/") || StringUtils.containsIgnoreCase(contentType, "+text")) {
closure = new MethodClosure(this, "encodeText");
} else {
closure = null;
}
return closure;
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Test StringUtils.testStartsWithIgnoreCase()
*/
@Test
public void testStartsWithIgnoreCase() {
assertTrue("startsWithIgnoreCase(null, null)", StringUtils.startsWithIgnoreCase(null, null));
assertFalse("startsWithIgnoreCase(FOOBAR, null)", StringUtils.startsWithIgnoreCase(FOOBAR, null));
assertFalse("startsWithIgnoreCase(null, FOO)", StringUtils.startsWithIgnoreCase(null, FOO));
assertTrue("startsWithIgnoreCase(FOOBAR, \"\")", StringUtils.startsWithIgnoreCase(FOOBAR, ""));
assertTrue("startsWithIgnoreCase(foobar, foo)", StringUtils.startsWithIgnoreCase(foobar, foo));
assertTrue("startsWithIgnoreCase(FOOBAR, FOO)", StringUtils.startsWithIgnoreCase(FOOBAR, FOO));
assertTrue("startsWithIgnoreCase(foobar, FOO)", StringUtils.startsWithIgnoreCase(foobar, FOO));
assertTrue("startsWithIgnoreCase(FOOBAR, foo)", StringUtils.startsWithIgnoreCase(FOOBAR, foo));
assertFalse("startsWithIgnoreCase(foo, foobar)", StringUtils.startsWithIgnoreCase(foo, foobar));
assertFalse("startsWithIgnoreCase(foo, foobar)", StringUtils.startsWithIgnoreCase(bar, foobar));
assertFalse("startsWithIgnoreCase(foobar, bar)", StringUtils.startsWithIgnoreCase(foobar, bar));
assertFalse("startsWithIgnoreCase(FOOBAR, BAR)", StringUtils.startsWithIgnoreCase(FOOBAR, BAR));
assertFalse("startsWithIgnoreCase(foobar, BAR)", StringUtils.startsWithIgnoreCase(foobar, BAR));
assertFalse("startsWithIgnoreCase(FOOBAR, bar)", StringUtils.startsWithIgnoreCase(FOOBAR, bar));
}
代码示例来源:origin: apache/incubator-gobblin
if (StringUtils.startsWithIgnoreCase(field.getType(), "map")) {
continue;
代码示例来源:origin: com.jayway.restassured/rest-assured
private Closure tryToFindMatchingEncoder(String contentType) {
final Closure closure;
if (contentType == null) {
closure = null;
} else if (StringUtils.startsWithIgnoreCase(contentType, "text/") || StringUtils.containsIgnoreCase(contentType, "+text")) {
closure = new MethodClosure(this, "encodeText");
} else {
closure = null;
}
return closure;
}
代码示例来源:origin: winder/Universal-G-Code-Sender
/**
* Returns a new instance of a connection from an uri. The uri should be start with a protocol
* {@link ConnectionDriver#getProtocol()} that defines which driver to use. The driver may then
* have different styles for defining paths, ex: jserialcomm://{portname}:{baudrate}
*
* @param uri the uri for the hardware to connect to
* @return a connection
* @throws ConnectionException if something went wron while creating the connection
*/
static public Connection getConnection(String uri) throws ConnectionException{
for (ConnectionDriver connectionDriver : ConnectionDriver.values()) {
if (StringUtils.startsWithIgnoreCase(uri, connectionDriver.getProtocol())) {
Connection connection = getConnection(connectionDriver).orElseThrow(() -> new ConnectionException("Couldn't load connection driver " + connectionDriver + " for uri: " + uri));
connection.setUri(uri);
return connection;
}
}
throw new ConnectionException("Couldn't find connection driver for uri: " + uri);
}
代码示例来源:origin: Erudika/para
/**
* Is the main identifier a SAML account.
* @return true if user is signed in with a SAML account
*/
@JsonIgnore
public boolean isSAMLUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.SAML_PREFIX);
}
代码示例来源:origin: com.erudika/para
/**
* Is the main identifier a Facebook id
* @return true if user is signed in with Facebook
*/
@JsonIgnore
public boolean isFacebookUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.FB_PREFIX);
}
代码示例来源:origin: com.erudika/para
/**
* Is the main identifier a LinkedIn id
* @return true if user is signed in with LinkedIn
*/
@JsonIgnore
public boolean isLinkedInUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.LINKEDIN_PREFIX);
}
代码示例来源:origin: Erudika/para
/**
* Is the main identifier a Facebook id.
* @return true if user is signed in with Facebook
*/
@JsonIgnore
public boolean isFacebookUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.FB_PREFIX);
}
代码示例来源:origin: Erudika/para
/**
* Is the main identifier a Twitter id.
* @return true if user is signed in with Twitter
*/
@JsonIgnore
public boolean isTwitterUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.TWITTER_PREFIX);
}
代码示例来源:origin: Erudika/para
/**
* Is the main identifier a GitHub id.
* @return true if user is signed in with GitHub
*/
@JsonIgnore
public boolean isGitHubUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.GITHUB_PREFIX);
}
代码示例来源:origin: Erudika/para
/**
* Is the main identifier a LDAP account.
* @return true if user is signed in with a LDAP account
*/
@JsonIgnore
public boolean isLDAPUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.LDAP_PREFIX);
}
代码示例来源:origin: Erudika/para
/**
* Is the main identifier a Google+ id.
* @return true if user is signed in with Google+
*/
@JsonIgnore
public boolean isGooglePlusUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.GPLUS_PREFIX);
}
代码示例来源:origin: Erudika/para
/**
* Is the main identifier a LinkedIn id.
* @return true if user is signed in with LinkedIn
*/
@JsonIgnore
public boolean isLinkedInUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.LINKEDIN_PREFIX);
}
代码示例来源:origin: Erudika/para
/**
* Is the main identifier a Microsoft/Windows account id.
* @return true if user is signed in with a Microsoft account
*/
@JsonIgnore
public boolean isMicrosoftUser() {
return StringUtils.startsWithIgnoreCase(identifier, Config.MICROSOFT_PREFIX);
}
代码示例来源:origin: com.foreach.across.modules/debug-web-module
public boolean isStandardSpring() {
return StringUtils.startsWithIgnoreCase( getName(), "org.springframework." );
}
}
代码示例来源:origin: com.atlassian.mail/atlassian-mail
@Override
public void setJndiLocation(String jndiLocation)
{
if (StringUtils.isNotBlank(jndiLocation) && !StringUtils.startsWithIgnoreCase(jndiLocation, JNDI_JAVA_SCHEME))
{
throw new IllegalArgumentException("Only the java URL scheme(java:) is allowed for the jndiLocation");
}
this.jndiLocation = jndiLocation;
propertyChanged();
}
代码示例来源:origin: DSpace/DSpace
@Override
public AuthorityValue getAuthorityValueType(String metadataString) {
AuthorityValue fromAuthority = null;
for (AuthorityValue type : authorityTypes.getTypes()) {
if (StringUtils.startsWithIgnoreCase(metadataString, type.getAuthorityType())) {
fromAuthority = type;
}
}
return fromAuthority;
}
内容来源于网络,如有侵权,请联系作者删除!