當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.startsWithIgnoreCase方法代碼示例

本文整理匯總了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;
}
 
開發者ID:ViniciusArnhold,項目名稱:ProjectAltaria,代碼行數:18,代碼來源:MessageUtils.java

示例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;
}
 
開發者ID:Linguaculturalists,項目名稱:Phoenicia,代碼行數:22,代碼來源:MigrationHelper.java

示例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));
        }
    }
}
 
開發者ID:KayLerch,項目名稱:alexa-utterance-generator,代碼行數:25,代碼來源:SkillBuilderModel.java

示例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;
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:14,代碼來源:RequestEntityRestStorageService.java

示例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;
    }
}
 
開發者ID:zhaoqilong3031,項目名稱:spring-cloud-samples,代碼行數:12,代碼來源:WebUtils.java

示例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);
    }
}
 
開發者ID:virjar,項目名稱:vscrawler,代碼行數:9,代碼來源:StartsWith.java

示例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;
}
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:63,代碼來源:AdminPostsController.java

示例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);
        }

    }
 
開發者ID:BigBrassBand,項目名稱:remittanceparse,代碼行數:61,代碼來源:RemittancePdf.java

示例9: matchSeed

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public boolean matchSeed(Seed seed) {
    return StringUtils.startsWithIgnoreCase(seed.getData(), prefix);
}
 
開發者ID:virjar,項目名稱:vscrawler,代碼行數:5,代碼來源:PreffixSeedRouter.java


注:本文中的org.apache.commons.lang3.StringUtils.startsWithIgnoreCase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。