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


Java StringUtils.contains方法代碼示例

本文整理匯總了Java中org.apache.commons.lang3.StringUtils.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.contains方法的具體用法?Java StringUtils.contains怎麽用?Java StringUtils.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.lang3.StringUtils的用法示例。


在下文中一共展示了StringUtils.contains方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: find

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public Path find() throws BackgroundException {
    final Path home = super.find();
    if(home == DEFAULT_HOME) {
        final String user;
        final Credentials credentials = session.getHost().getCredentials();
        if(StringUtils.contains(credentials.getUsername(), ':')) {
            user = StringUtils.splitPreserveAllTokens(credentials.getUsername(), ':')[1];
        }
        else {
            user = credentials.getUsername();
        }
        return new Path(new StringBuilder()
                .append(Path.DELIMITER).append(session.getRegion())
                .append(Path.DELIMITER).append("home")
                .append(Path.DELIMITER).append(user)
                .toString(), EnumSet.of(Path.Type.directory, Path.Type.volume));
    }
    return home;
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:21,代碼來源:IRODSHomeFinderService.java

示例2: map

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public BackgroundException map(final IOException failure) {
    final Throwable[] stack = ExceptionUtils.getThrowables(failure);
    for(Throwable t : stack) {
        if(t instanceof BackgroundException) {
            return (BackgroundException) t;
        }
    }
    if(failure instanceof SSLException) {
        return new SSLExceptionMappingService().map((SSLException) failure);
    }
    final StringBuilder buffer = new StringBuilder();
    this.append(buffer, failure.getMessage());
    for(Throwable cause : ExceptionUtils.getThrowableList(failure)) {
        if(!StringUtils.contains(failure.getMessage(), cause.getMessage())) {
            this.append(buffer, cause.getMessage());
        }
    }
    return this.wrap(failure, buffer);
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:21,代碼來源:DefaultIOExceptionMappingService.java

示例3: getDBType

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * 獲取數據庫類型
 */
public static Database getDBType(DataSource dataSource){
	String jdbcUrl = getJdbcUrlFromDataSource(dataSource);
	
	if (StringUtils.contains(jdbcUrl, ":h2:")) {
		return Database.H2 ;
	} else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
		return Database.MYSQL ;
	} else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
		return Database.ORACLE ;
	} else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
		return Database.POSTGRESQL ;
	} else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
		return Database.SQL_SERVER ;
	}
	throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
}
 
開發者ID:geeker-lait,項目名稱:tasfe-framework,代碼行數:20,代碼來源:JPAUtil.java

示例4: getDisplayName

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * @param locale ISO Language identifier
 * @return Human readable language name in the target language
 */
public String getDisplayName(final String locale) {
    java.util.Locale l;
    if(StringUtils.contains(locale, "_")) {
        l = new java.util.Locale(locale.split("_")[0], locale.split("_")[1]);
    }
    else {
        l = new java.util.Locale(locale);
    }
    return StringUtils.capitalize(l.getDisplayName(l));
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:15,代碼來源:Preferences.java

示例5: removeTimeZone

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
private static String removeTimeZone(String dateTime) {
    if (dateTime == null)
        return null;

    if (StringUtils.contains(dateTime, "+"))
        return Helpers.split(dateTime, "+").get(0);
    else if (StringUtils.contains(dateTime, "-"))
        return Helpers.split(dateTime, "-").get(0);

    return dateTime;
}
 
開發者ID:endeavourhealth,項目名稱:HL7Receiver,代碼行數:12,代碼來源:DateParser.java

示例6: getByName

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
public ServiceDefinition getByName(String name) throws JAXBException, IOException {
	ServiceDefinition data = new ServiceDefinition();
	ArrayList<String> sDefs = util.getResourcesWithExtension("srvc", containerName);
	Unmarshaller unmarshaller = JAXBContext.newInstance(ServiceDefinition.class).createUnmarshaller();
	for (String sDef : sDefs) {
		File file = new File(sDef);
		if (file.exists() && StringUtils.contains(file.getName(), name)) {
			String content = FileUtils.readFileToString(file);
			data = (ServiceDefinition) unmarshaller.unmarshal(new StringReader(content));
			break;
		}
	}
	return data;
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:15,代碼來源:ServicesUtil.java

示例7: getLastComponent

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
private String getLastComponent(String fullName) {
    if (! StringUtils.contains(fullName, ".")) {
        return fullName;
    }
    int index = fullName.lastIndexOf('.');
    return fullName.substring(index + 1);
}
 
開發者ID:Sixt,項目名稱:ja-micro,代碼行數:8,代碼來源:RegistrationManager.java

示例8: getByName

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
public ComponentType getByName(String name) throws JAXBException, IOException {
	ComponentType data = new ComponentType();
	ArrayList<String> cDefs = util.getResourcesWithExtension("cdef", containerName);
	Unmarshaller unmarshaller = JAXBContext.newInstance(ComponentType.class).createUnmarshaller();
	for (String cDef : cDefs) {
		File file = new File(cDef);
		if (file.exists() && StringUtils.contains(file.getName(), name)) {
			String content = FileUtils.readFileToString(file);
			data = ((JAXBElement<ComponentType>) unmarshaller.unmarshal(new StringReader(content))).getValue();
			break;
		}
	}
	return data;
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:15,代碼來源:CompDefUtil.java

示例9: setReferer

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * 設置Referer
 * 
 */
public static void setReferer() {
    String refererPath = (String) ServletActionContext.getRequest().getHeader(REFERER_KEY);
    // 如果URL裏沒有本站域名的話,設置本站域名為默認值
    if (!(StringUtils.contains(refererPath, YiDuConstants.yiduConf.getString(YiDuConfig.URI)) && StringUtils
            .contains(refererPath, YiDuConstants.yiduConf.getString(YiDuConfig.URI)))) {
        refererPath = YiDuConstants.yiduConf.getString(YiDuConfig.URI);
    }
    HttpSession session = getSession(true);
    logger.debug("REFERER_KEY : " + refererPath);
    session.setAttribute(REFERER_KEY, refererPath);
}
 
開發者ID:luckyyeah,項目名稱:YiDu-Novel,代碼行數:16,代碼來源:LoginManager.java

示例10: relativize

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
public static String relativize(String root, final String path) {
    if(StringUtils.isBlank(root)) {
        return path;
    }
    if(!StringUtils.equals(root, String.valueOf(Path.DELIMITER))) {
        root = root + String.valueOf(Path.DELIMITER);
    }
    if(StringUtils.contains(path, root)) {
        return StringUtils.substring(path, path.indexOf(root) + root.length());
    }
    return path;
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:13,代碼來源:PathRelativizer.java

示例11: removeEmptyTags

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
public static String removeEmptyTags(String string, Class clazz) {
	String ret = "";
	ArrayList<String> fin = new ArrayList<String>();
	if (StringUtils.contains(string, "\"\"")) {
		String[] brk = StringUtils.split(string, " ");
		for (String str : brk) {
			if (!StringUtils.contains(str, "\"\""))
				fin.add(str);
			else if (StringUtils.contains(str, "/>"))
				fin.add("/>");
			else if (StringUtils.contains(str, ">"))
				fin.add(">");
		}
	}
	if (fin.size() > 0)
		for (String val : fin) {
			ret += val + " ";
		}
	else
		ret = string;
	try {
		JAXBContext ctx = JAXBContext.newInstance(clazz);
		Unmarshaller unmarshaller = ctx.createUnmarshaller();
		MarshallerImpl marshaller = (MarshallerImpl) ctx.createMarshaller();
		marshaller.setProperty(MarshallerImpl.JAXB_FORMATTED_OUTPUT, true);
		marshaller.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper", new NamespacePrefixMapper());
		StringWriter writer = new StringWriter();
		marshaller.marshal(unmarshaller.unmarshal(new StringReader(ret)), writer);
		ret = writer.toString();
	} catch (Exception e) {
	}
	return ret;
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:34,代碼來源:ParseUtil.java

示例12: wasSuccessful

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public boolean wasSuccessful() {
  return StringUtils.contains(output, SvnUtils.REVISION)
      && !StringUtils.contains(output, SvnUtils.SVN_ERROR_PREFIX);
}
 
開發者ID:lpavone,項目名稱:SVNAutoMerger,代碼行數:6,代碼來源:UpdateBranch.java

示例13: getRegion

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
protected String getRegion() {
    if(StringUtils.contains(host.getRegion(), ':')) {
        return StringUtils.splitPreserveAllTokens(host.getRegion(), ':')[0];
    }
    return host.getRegion();
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:7,代碼來源:IRODSSession.java

示例14: accept

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public boolean accept(File arg0) {
	return !(StringUtils.contains(arg0.getAbsolutePath(), "model"));
}
 
開發者ID:dstl,項目名稱:Open_Source_ECOA_Toolset_AS5,代碼行數:5,代碼來源:CopyrightAmend.java

示例15: isPartJSON

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
private boolean isPartJSON(Map<String, String> headers) {
    String contentType = getMultipartHeaderValue(headers, HttpConfig.HttpHeaders.CONTENT_TYPE);
    return StringUtils.contains(contentType, HttpConfig.ContentTypes.JSON);
}
 
開發者ID:dueros,項目名稱:dcs-sdk-java,代碼行數:5,代碼來源:MultipartParser.java


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