本文整理汇总了Java中org.apache.commons.lang3.StringUtils.startsWithIgnoreCase方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.startsWithIgnoreCase方法的具体用法?Java StringUtils.startsWithIgnoreCase怎么用?Java StringUtils.startsWithIgnoreCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.startsWithIgnoreCase方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isMyCommand
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static boolean isMyCommand(String message, @NotNull ICommand thiz) {
message = message.trim();
@NotNull final String prefix = Prefixes.getInstance().current();
if (!message.startsWith(prefix)) {
return false;
}
if (StringUtils.startsWithIgnoreCase(message, prefix + thiz.command())) {
return true;
}
for (String alias : thiz.aliases()) {
if (StringUtils.startsWithIgnoreCase(message, prefix + alias)) {
return true;
}
}
return false;
}
示例2: getRelationTableNames
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public List<String> getRelationTableNames(String table) {
List<String> result = new ArrayList<String>();
String sql = "SELECT name FROM sqlite_master WHERE type='table' AND (name LIKE '" + table + "#_%' OR name LIKE '%#_" + table +"' ESCAPE '#')";
Cursor c = getCursor(sql);
while(c.moveToNext()) {
String name = c.getString(c.getColumnIndexOrThrow("name"));
if(!name.equalsIgnoreCase(table) && (
StringUtils.startsWithIgnoreCase(name, table) ||
StringUtils.endsWithIgnoreCase(name, table)
)) {
result.add(name);
}
}
close(c);
return result;
}
示例3: addSample
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public void addSample(final String sample) {
final String[] words = sample.split(" ");
final String intentName = words.length < 1 || StringUtils.isBlank(words[0]) ? DEFAULT_INTENT_NAME : words[0];
final String sampleUtterance = words.length > 1 ? sample.substring(sample.indexOf(" ") + 1).trim() : "";
// skip blank utterances except for builtin-intents that can exist without samples
if (StringUtils.isBlank(sampleUtterance) && !StringUtils.startsWithIgnoreCase(intentName, "AMAZON.")) return;
final Optional<Intent> intent = intents.stream().filter(i -> i.getName().equals(intentName)).findFirst();
if (intent.isPresent()) {
intent.get().addSample(sampleUtterance);
} else {
intents.add(new Intent(intentName, sampleUtterance));
}
final Matcher slotsInUtterance = Pattern.compile("\\{(.*?)\\}").matcher(sampleUtterance);
// for any of the placeholder ...
while (slotsInUtterance.find()) {
final String slotName = slotsInUtterance.group(1);
if (!StringUtils.startsWithIgnoreCase(slotName,"AMAZON.") && types.stream().noneMatch(t -> t.getName().equals(slotName))) {
types.add(new SlotType(slotName));
}
}
}
示例4: isXmlContentType
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
protected boolean isXmlContentType(final String contentType) {
if(null == contentType) {
return false;
}
if(StringUtils.startsWithIgnoreCase(contentType, "application/xml")) {
return true;
}
if(StringUtils.startsWithIgnoreCase(contentType, "text/xml")) {
return true;
}
return false;
}
示例5: getPathWithinApplication
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String getPathWithinApplication(HttpServletRequest request) {
String contextPath = getContextPath(request);
String requestUri = getRequestUri(request);
if (StringUtils.startsWithIgnoreCase(requestUri, contextPath)) {
// Normal case: URI contains context path.
String path = requestUri.substring(contextPath.length());
return (StringUtils.isNotBlank(path) ? path : "/");
} else {
return requestUri;
}
}
示例6: handle
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
protected boolean handle(String input, String searchString, boolean ignoreCase) {
if (ignoreCase) {
return StringUtils.startsWithIgnoreCase(input, searchString);
} else {
return StringUtils.startsWith(input, searchString);
}
}
示例7: getPagePreviewImage
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private PostDTO getPagePreviewImage(PagePreviewDTO page, String sourceLink, Integer imageIndex) {
String postSource = PostUtils.createPostSource(sourceLink);
PostDTO tmpDTO = new PostDTO();
String imageUrl = null;
Boolean hasImages = true;
if (imageIndex == null) {
// populating the postDTO image contents for addLink form
if (page.twitterDTO != null) {
imageUrl = page.getTwitterDTO().getTwitterImage();
if (imageUrl != null) {
if (!StringUtils.startsWithIgnoreCase(imageUrl, "http"))
imageUrl = null;
}
} else {
if (page.getImages().size() > 1) {
imageUrl = page.getImages().get(1).getSrc();
} else
hasImages = false;
}
// if twitter image url missing or page contains single image
if (StringUtils.isEmpty(imageUrl)) {
hasImages = false;
imageUrl = null;
}
} else {
// determining the final postDTO from addLink form carousel index
imageUrl = page.getImages().get(imageIndex).getSrc();
}
// At some future point may require a database lookup approach:
// if getNoImageSources(postSource) != null, imageUrl = "/images...{postSource}.png"
if (postSource != null) {
switch (postSource.toLowerCase()) {
case "stackoverflow.com":
imageUrl = "/images/posts/stackoverflow.png";
hasImages = false;
break;
case "spring.io":
case "docs.spring.io":
imageUrl = "/images/posts/spring.png";
hasImages = false;
break;
case "github.com":
imageUrl = "/images/posts/github.png";
hasImages = false;
break;
default:
break;
}
}
tmpDTO.setPostImage(imageUrl);
tmpDTO.setHasImages(hasImages);
return tmpDTO;
}
示例8: handleDate
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private void handleDate(File tempTsvFileForDate) throws IOException, ParserException {
String date=null;
try(BufferedReader reader=new BufferedReader(new FileReader(tempTsvFileForDate)))
{
for(String line=reader.readLine();line!=null;line=reader.readLine())
{
line=line.trim();
if(!StringUtils.startsWithIgnoreCase(line,"Date"))
continue;
final String[] split = StringUtils.splitByWholeSeparator(line, " ");
if(split.length!=2)
throw new ParserException("Could not parse date field: "+line);
date=split[1];
break;
}
}
if(date==null)
throw new ParserException("Never found date field");
//start guessing at the date format
boolean isEuroDate=isEuroDate(date);
boolean isUSDate=isUSDate(date);
if(!isEuroDate && !isUSDate)
throw new ParserException("Could not parse date field: "+date);
if(isEuroDate && !isUSDate) {
dateParser = Format.euroDateFormatter;
return;
}
if(!isEuroDate) {
dateParser = Format.usDateFormatter;
return;
}
//hmmm.... date is valid in both formats. Use the filename instead
try {
final String[] array = StringUtils.splitByWholeSeparator(inputPdfFile.getName(), "-");
int year = Integer.parseInt(array[0]);
int month = Integer.parseInt(array[1]);
if (year < 2017 || month <= 6)
dateParser = Format.euroDateFormatter;
else
dateParser = Format.usDateFormatter;
remittanceDate=dateParser.parse(date);
}
catch (Throwable t)
{
throw new ParserException("Can not determine date format to use.",t);
}
}
示例9: matchSeed
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@Override
public boolean matchSeed(Seed seed) {
return StringUtils.startsWithIgnoreCase(seed.getData(), prefix);
}