List of usage examples for org.apache.commons.lang3 StringUtils lastIndexOfIgnoreCase
public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr)
Case in-sensitive find of the last index within a CharSequence.
A null CharSequence will return -1 .
From source file:kenh.expl.functions.LastIndexOf.java
public int process(String seq, String searchSeq, boolean ignoreCase) { if (ignoreCase) return StringUtils.lastIndexOfIgnoreCase(seq, searchSeq); else//from w w w.ja va 2 s. c om return StringUtils.lastIndexOf(seq, searchSeq); }
From source file:org.yamj.core.service.metadata.nfo.InfoReader.java
/** * Parse Certification from the XML NFO file * * @param eCommon//w ww . j a va 2 s .c o m * @param movie */ private void parseCertification(Element eCommon, InfoDTO dto) { boolean certificationMPAA = this.configServiceWrapper.getBooleanProperty("yamj3.certification.mpaa", false); String tempCert; if (certificationMPAA) { tempCert = DOMHelper.getValueFromElement(eCommon, "mpaa"); if (StringUtils.isNotBlank(tempCert)) { String mpaa = MetadataTools.processMpaaCertification(tempCert); dto.addCertificatioInfo("MPAA", StringUtils.trimToNull(mpaa)); } } tempCert = DOMHelper.getValueFromElement(eCommon, "certification"); if (StringUtils.isNotBlank(tempCert)) { // scan for given countries List<String> countries = this.configServiceWrapper.getCertificationCountries(); for (String country : countries) { int countryPos = StringUtils.lastIndexOfIgnoreCase(tempCert, country); if (countryPos >= 0) { // We've found the country, so extract just that tag String certification = tempCert.substring(countryPos); int pos = certification.indexOf(':'); if (pos > 0) { int endPos = certification.indexOf("/"); if (endPos > 0) { // this is in the middle of the string certification = certification.substring(pos + 1, endPos); } else { // this is at the end of the string certification = certification.substring(pos + 1); } } dto.addCertificatioInfo(country, StringUtils.trimToNull(certification)); } if (certificationMPAA && StringUtils.containsIgnoreCase(tempCert, "Rated")) { // extract the MPAA rating from the certification String mpaa = MetadataTools.processMpaaCertification(tempCert); dto.addCertificatioInfo("MPAA", StringUtils.trimToNull(mpaa)); } } } }