本文整理汇总了Java中jodd.util.StringUtil.splitc方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.splitc方法的具体用法?Java StringUtil.splitc怎么用?Java StringUtil.splitc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jodd.util.StringUtil
的用法示例。
在下文中一共展示了StringUtil.splitc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveActiveProfiles
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Resolves active profiles from special property.
* This property can be only a base property!
* If default active property is not defined, nothing happens.
* Otherwise, it will replace currently active profiles.
*/
protected void resolveActiveProfiles() {
if (activeProfilesProp == null) {
activeProfiles = null;
return;
}
final PropsEntry pv = data.getBaseProperty(activeProfilesProp);
if (pv == null) {
// no active profile set as the property, exit
return;
}
final String value = pv.getValue();
if (StringUtil.isBlank(value)) {
activeProfiles = null;
return;
}
activeProfiles = StringUtil.splitc(value, ',');
StringUtil.trimAll(activeProfiles);
}
示例2: convertStringToArray
import jodd.util.StringUtil; //导入方法依赖的package包/类
@Override
protected String[] convertStringToArray(String value) {
String[] strings = StringUtil.splitc(value, NUMBER_DELIMITERS);
int count = 0;
for (int i = 0; i < strings.length; i++) {
strings[count] = strings[i].trim();
if (strings[count].length() == 0) {
continue;
}
if (!strings[count].startsWith(StringPool.HASH)) {
count++;
}
}
if (count != strings.length) {
return ArraysUtil.subarray(strings, 0, count);
}
return strings;
}
示例3: createPropertiesMap
import jodd.util.StringUtil; //导入方法依赖的package包/类
protected Map<String, String> createPropertiesMap(String attrValue, char propertiesDelimiter, char valueDelimiter) {
if (attrValue == null) {
return new LinkedHashMap<>();
}
String[] properties = StringUtil.splitc(attrValue, propertiesDelimiter);
LinkedHashMap<String, String> map = new LinkedHashMap<>(properties.length);
for (String property : properties) {
int valueDelimiterIndex = property.indexOf(valueDelimiter);
if (valueDelimiterIndex != -1) {
String propertyName = property.substring(0, valueDelimiterIndex).trim();
String propertyValue = property.substring(valueDelimiterIndex + 1).trim();
map.put(propertyName, propertyValue);
}
}
return map;
}
示例4: isContaining
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Returns true if attribute is containing some value.
*/
public boolean isContaining(String include) {
if (value == null) {
return false;
}
if (splits == null) {
splits = StringUtil.splitc(value, ' ');
}
for (String s : splits) {
if (s.equals(include)) {
return true;
}
}
return false;
}
示例5: isContaining
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Returns true if attribute is containing some value.
*/
public boolean isContaining(String include) {
if (value == null) {
return false;
}
if (splits == null) {
splits = StringUtil.splitc(value, ' ');
}
for (String s: splits) {
if (s.equals(include)) {
return true;
}
}
return false;
}
示例6: normalizeWords
import jodd.util.StringUtil; //导入方法依赖的package包/类
public String normalizeWords(String sentence) {
String[] split = StringUtil.splitc(sentence, ' ');
for (int i = 0; i < split.length; i++) {
String word = split[i];
for (StringPair stringPair : replacements) {
word = stringPair.replace(word);
}
split[i] = word;
}
return StringUtil.join(split, ' ');
}
示例7: parse
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Parses input dot-separated string that represents a path.
*/
public static Path parse(String path) {
if (path == null) {
return new Path();
}
return new Path(StringUtil.splitc(path, '.'));
}
示例8: readFrom
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Parses input stream and creates new <code>HttpRequest</code> object.
*/
public static HttpRequest readFrom(InputStream in) {
BufferedReader reader;
try {
reader = new BufferedReader(new InputStreamReader(in, StringPool.ISO_8859_1));
} catch (UnsupportedEncodingException uneex) {
return null;
}
HttpRequest httpRequest = new HttpRequest();
String line;
try {
line = reader.readLine();
} catch (IOException ioex) {
throw new HttpException(ioex);
}
if (!StringUtil.isBlank(line)) {
String[] s = StringUtil.splitc(line, ' ');
httpRequest.method(s[0]);
httpRequest.path(s[1]);
httpRequest.httpVersion(s[2]);
httpRequest.readHeaders(reader);
httpRequest.readBody(reader);
}
return httpRequest;
}
示例9: getExceptionsArray
import jodd.util.StringUtil; //导入方法依赖的package包/类
public String[] getExceptionsArray() { // jodd
if (exceptions == null) {
return null;
}
String[] result = StringUtil.splitc(exceptions.toString(), ',');
StringUtil.trimAll(result);
return result;
}
示例10: getIpAsInt
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Returns IP address as integer.
*/
public static int getIpAsInt(String ipAddress) {
int ipIntValue = 0;
String[] tokens = StringUtil.splitc(ipAddress, '.');
for (String token : tokens) {
if (ipIntValue > 0) {
ipIntValue <<= 8;
}
ipIntValue += Integer.parseInt(token);
}
return ipIntValue;
}
示例11: createPropertiesSet
import jodd.util.StringUtil; //导入方法依赖的package包/类
protected Set<String> createPropertiesSet(String attrValue, char propertiesDelimiter) {
if (attrValue == null) {
return new LinkedHashSet<>();
}
String[] properties = StringUtil.splitc(attrValue, propertiesDelimiter);
LinkedHashSet<String> set = new LinkedHashSet<>(properties.length);
Collections.addAll(set, properties);
return set;
}
示例12: parse
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Parses string of selectors (separated with <b>,</b>). Returns
* list of {@link CssSelector} lists in the same order.
*/
public static List<List<CssSelector>> parse(String query) {
String[] singleQueries = StringUtil.splitc(query, ',');
List<List<CssSelector>> selectors = new ArrayList<>(singleQueries.length);
for (String singleQuery : singleQueries) {
selectors.add(new CSSelly(singleQuery).parse());
}
return selectors;
}
示例13: init
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Filter initialization.
*/
public void init(FilterConfig config) throws ServletException {
try {
wildcards = Convert.toBooleanValue(config.getInitParameter("wildcards"), false);
} catch (TypeConversionException ignore) {
wildcards = false;
}
// match string
String uriMatch = config.getInitParameter("match");
if ((uriMatch != null) && (uriMatch.equals("*") == false)) {
matches = StringUtil.splitc(uriMatch, ',');
for (int i = 0; i < matches.length; i++) {
matches[i] = matches[i].trim();
}
}
// exclude string
String uriExclude = config.getInitParameter("exclude");
if (uriExclude != null) {
excludes = StringUtil.splitc(uriExclude, ',');
for (int i = 0; i < excludes.length; i++) {
excludes[i] = excludes[i].trim();
}
}
}
示例14: parse
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Parses string of selectors (separated with <b>,</b>). Returns
* list of {@link CssSelector} lists in the same order.
*/
public static List<List<CssSelector>> parse(String query) {
String[] singleQueries = StringUtil.splitc(query, ',');
List<List<CssSelector>> selectors = new ArrayList<List<CssSelector>>(singleQueries.length);
for (String singleQuery: singleQueries) {
selectors.add(new CSSelly(singleQuery).parse());
}
return selectors;
}
示例15: StringPair
import jodd.util.StringUtil; //导入方法依赖的package包/类
public StringPair(String fullLine) {
String[] pairs = StringUtil.splitc(fullLine, ' ');
from = StringUtil.replaceChar(pairs[0], '+', ' ');
to = StringUtil.replaceChar(pairs[1], '+', ' ');
}