本文整理了Java中org.apache.commons.lang3.StringUtils.stripAll()
方法的一些代码示例,展示了StringUtils.stripAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringUtils.stripAll()
方法的具体详情如下:
包路径:org.apache.commons.lang3.StringUtils
类名称:StringUtils
方法名:stripAll
[英]Strips whitespace from the start and end of every String in an array. Whitespace is defined by Character#isWhitespace(char).
A new array is returned each time, except for length zero. A null array will return null. An empty array will return itself. A null array entry will be ignored.
StringUtils.stripAll(null) = null
StringUtils.stripAll([]) = []
StringUtils.stripAll(["abc", " abc"]) = ["abc", "abc"]
StringUtils.stripAll(["abc ", null]) = ["abc", null]
[中]从数组中每个字符串的开头和结尾去除空白。空格由字符#isWhitespace(char)定义。
每次都返回一个新数组,长度为零的数组除外。null数组将返回null。空数组将返回自身。将忽略空数组项。
StringUtils.stripAll(null) = null
StringUtils.stripAll([]) = []
StringUtils.stripAll(["abc", " abc"]) = ["abc", "abc"]
StringUtils.stripAll(["abc ", null]) = ["abc", null]
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* <p>Strips whitespace from the start and end of every String in an array.
* Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <p>A new array is returned each time, except for length zero.
* A {@code null} array will return {@code null}.
* An empty array will return itself.
* A {@code null} array entry will be ignored.</p>
*
* <pre>
* StringUtils.stripAll(null) = null
* StringUtils.stripAll([]) = []
* StringUtils.stripAll(["abc", " abc"]) = ["abc", "abc"]
* StringUtils.stripAll(["abc ", null]) = ["abc", null]
* </pre>
*
* @param strs the array to remove whitespace from, may be null
* @return the stripped Strings, {@code null} if null array input
*/
public static String[] stripAll(final String... strs) {
return stripAll(strs, null);
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testStripAll() {
// test stripAll method, merely an array version of the above strip
final String[] empty = new String[0];
final String[] fooSpace = new String[] { " "+FOO+" ", " "+FOO, FOO+" " };
final String[] fooDots = new String[] { ".."+FOO+"..", ".."+FOO, FOO+".." };
final String[] foo = new String[] { FOO, FOO, FOO };
assertNull(StringUtils.stripAll((String[]) null));
// Additional varargs tests
assertArrayEquals(empty, StringUtils.stripAll()); // empty array
assertArrayEquals(new String[]{null}, StringUtils.stripAll((String) null)); // == new String[]{null}
assertArrayEquals(empty, StringUtils.stripAll(empty));
assertArrayEquals(foo, StringUtils.stripAll(fooSpace));
assertNull(StringUtils.stripAll(null, null));
assertArrayEquals(foo, StringUtils.stripAll(fooSpace, null));
assertArrayEquals(foo, StringUtils.stripAll(fooDots, "."));
}
代码示例来源:origin: plutext/docx4j
String[] tokens = StringUtils.stripAll(replacement.getSubstFonts().split(";"));
代码示例来源:origin: apache/nifi
consumer.setComponentNameRegexExclude(context.getProperty(FILTER_COMPONENT_NAME_EXCLUDE).evaluateAttributeExpressions().getValue());
final String[] targetEventTypes = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_EVENT_TYPE).evaluateAttributeExpressions().getValue(), ','));
if(targetEventTypes != null) {
for(String type : targetEventTypes) {
final String[] targetEventTypesExclude = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_EVENT_TYPE_EXCLUDE).evaluateAttributeExpressions().getValue(), ','));
if(targetEventTypesExclude != null) {
for(String type : targetEventTypesExclude) {
final String[] targetComponentIds = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_COMPONENT_ID).evaluateAttributeExpressions().getValue(), ','));
if(targetComponentIds != null) {
consumer.addTargetComponentId(targetComponentIds);
final String[] targetComponentIdsExclude = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_COMPONENT_ID_EXCLUDE).evaluateAttributeExpressions().getValue(), ','));
if(targetComponentIdsExclude != null) {
consumer.addTargetComponentIdExclude(targetComponentIdsExclude);
代码示例来源:origin: apache/roller
public String[] stripAll(String[] strs) {
return StringUtils.stripAll(strs);
}
代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3
/**
* <p>Strips whitespace from the start and end of every String in an array.
* Whitespace is defined by {@link CharUtils#isWhitespace(char)}.</p>
*
* <p>A new array is returned each time, except for length zero.
* A {@code null} array will return {@code null}.
* An empty array will return itself.
* A {@code null} array entry will be ignored.</p>
*
* <pre>
* StringUtils.stripAll(null) = null
* StringUtils.stripAll([]) = []
* StringUtils.stripAll(["abc", " abc"]) = ["abc", "abc"]
* StringUtils.stripAll(["abc ", null]) = ["abc", null]
* </pre>
*
* @param strs the array to remove whitespace from, may be null
* @return the stripped Strings, {@code null} if null array input
*/
public static String[] stripAll(final String... strs) {
return stripAll(strs, null);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* <p>Strips whitespace from the start and end of every String in an array.
* Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <p>A new array is returned each time, except for length zero.
* A {@code null} array will return {@code null}.
* An empty array will return itself.
* A {@code null} array entry will be ignored.</p>
*
* <pre>
* StringUtils.stripAll(null) = null
* StringUtils.stripAll([]) = []
* StringUtils.stripAll(["abc", " abc"]) = ["abc", "abc"]
* StringUtils.stripAll(["abc ", null]) = ["abc", null]
* </pre>
*
* @param strs the array to remove whitespace from, may be null
* @return the stripped Strings, {@code null} if null array input
*/
public static String[] stripAll(final String... strs) {
return stripAll(strs, null);
}
代码示例来源:origin: io.virtdata/virtdata-lib-curves4
/**
* <p>Strips whitespace from the start and end of every String in an array.
* Whitespace is defined by {@link Character#isWhitespace(char)}.</p>
*
* <p>A new array is returned each time, except for length zero.
* A {@code null} array will return {@code null}.
* An empty array will return itself.
* A {@code null} array entry will be ignored.</p>
*
* <pre>
* StringUtils.stripAll(null) = null
* StringUtils.stripAll([]) = []
* StringUtils.stripAll(["abc", " abc"]) = ["abc", "abc"]
* StringUtils.stripAll(["abc ", null]) = ["abc", null]
* </pre>
*
* @param strs the array to remove whitespace from, may be null
* @return the stripped Strings, {@code null} if null array input
*/
public static String[] stripAll(final String... strs) {
return stripAll(strs, null);
}
代码示例来源:origin: uk.gov.gchq.gaffer/federated-store
public static List<String> getCleanStrings(final String value) {
final List<String> values;
if (value != null) {
values = Lists.newArrayList(StringUtils.stripAll(value.split(SCHEMA_DEL_REGEX)));
values.removeAll(STRINGS_TO_REMOVE);
} else {
values = null;
}
return values;
}
代码示例来源:origin: info.magnolia/magnolia-core
private static String[] getNamesBetweenPlaceholders(String propertiesFilesString, String contextNamePlaceHolder) {
final String[] names = StringUtils.substringsBetween(
propertiesFilesString,
PLACEHOLDER_PREFIX + contextNamePlaceHolder,
PLACEHOLDER_SUFFIX);
return StringUtils.stripAll(names);
}
代码示例来源:origin: apache/roller
public void init(FilterConfig filterConfig) throws ServletException {
// Construct our list of ignored urls
String urls = WebloggerConfig.getProperty("salt.ignored.urls");
String[] urlsArray = StringUtils.stripAll(StringUtils.split(urls, ","));
for (int i = 0; i < urlsArray.length; i++) {
this.ignored.add(urlsArray[i]);
}
}
代码示例来源:origin: rancher/cattle
protected PooledResourceOptions getPoolOptions(IpAddress ipAddress, Instance instance) {
PooledResourceOptions options = new PooledResourceOptions();
if (instance != null) {
String ip = DataAccessor.fieldString(instance, InstanceConstants.FIELD_REQUESTED_IP_ADDRESS);
if (ip != null) {
if(!StringUtils.isEmpty(ip)) {
options.setRequestedItems(Arrays.asList(StringUtils.stripAll(StringUtils.split(ip, ","))));
}
}
}
return options;
}
代码示例来源:origin: apache/roller
String[] plugins = StringUtils.stripAll(StringUtils.split(pluginStr, ","));
for (int i=0; i < plugins.length; i++) {
log.debug("trying " + plugins[i]);
代码示例来源:origin: rancher/cattle
InstanceConstants.FIELD_REQUESTED_IP_ADDRESS);
if (requestedIpObj != null && !StringUtils.isEmpty(requestedIpObj.toString())) {
requestedIps.addAll(Arrays.asList(StringUtils.stripAll(StringUtils.split(requestedIpObj.toString(), ","))));
} else {
.get(SystemLabels.LABEL_REQUESTED_IP);
if (!StringUtils.isEmpty(requestedIp)) {
requestedIps.addAll(Arrays.asList(StringUtils.stripAll(StringUtils.split(requestedIp, ","))));
代码示例来源:origin: org.xworker/xworker_core
public static String[] stripAll(ActionContext actionContext){
Thing self = actionContext.getObject("self");
String[] strs = (String[]) self.doAction("getStrs", actionContext);
String stripChars = (String) self.doAction("getStripChars", actionContext);
return StringUtils.stripAll(strs, stripChars);
}
代码示例来源:origin: com.nesscomputing.components/ness-config
CombinedConfiguration load()
{
// Allow foo/bar/baz and foo:bar:baz
final String [] configNames = StringUtils.stripAll(StringUtils.split(configName, "/:"));
final CombinedConfiguration cc = new CombinedConfiguration(new OverrideCombiner());
// All properties can be overridden by the System properties.
cc.addConfiguration(new SystemConfiguration(), "systemProperties");
boolean loadedConfig = false;
for (int i = 0; i < configNames.length; i++) {
final String configFileName = configNames[configNames.length - i - 1];
final String configFilePath = StringUtils.join(configNames, "/", 0, configNames.length - i);
try {
final AbstractConfiguration subConfig = configStrategy.load(configFileName, configFilePath);
if (subConfig == null) {
LOG.debug("Configuration '%s' does not exist, skipping", configFileName);
}
else {
cc.addConfiguration(subConfig, configFileName);
loadedConfig = true;
}
} catch (ConfigurationException ce) {
LOG.error(String.format("While loading configuration '%s'", configFileName), ce);
}
}
if (!loadedConfig && configNames.length > 0) {
LOG.warn("Config name '%s' was given but no config file could be found, this looks fishy!", configName);
}
return cc;
}
代码示例来源:origin: rancher/cattle
protected IPAssignment allocateIp(IpAddress ipAddress, Network network) {
Instance instance = getInstanceForPrimaryIp(ipAddress);
IPAssignment ip = null;
String requestedIp = null;
if (instance != null) {
String allocatedIpAddress = DataAccessor
.fieldString(instance, InstanceConstants.FIELD_ALLOCATED_IP_ADDRESS);
if (allocatedIpAddress != null) {
ip = new IPAssignment(allocatedIpAddress, null);
}
requestedIp = DataAccessor.fieldString(instance, InstanceConstants.FIELD_REQUESTED_IP_ADDRESS);
}
if (ip == null) {
List<String> list = new ArrayList<>();
if (!StringUtils.isEmpty(requestedIp)) {
list = Arrays.asList(StringUtils.stripAll(StringUtils.split(requestedIp, ",")));
}
ip = networkService.assignIpAddress(network, ipAddress, list);
if (ip == null) {
objectProcessManager.scheduleStandardProcess(StandardProcess.DEACTIVATE, ipAddress, null);
throw new ResourceExhaustionException("IP allocation error", "Failed to allocate IP from subnet", ipAddress);
}
}
return ip;
}
代码示例来源:origin: ch.inftec.ju/ju-util
@Test
public void stringUtils() {
String s1 = "hello, world,test ,bla";
TestUtils.assertArrayEquals(new String[] {"hello", " world", "test ", "bla"}, StringUtils.split(s1, ','));
TestUtils.assertArrayEquals(new String[] {"hello", "world", "test", "bla"}, StringUtils.stripAll(StringUtils.split(s1, ',')));
}
}
代码示例来源:origin: org.apache.nifi/nifi-site-to-site-reporting-task
consumer.setComponentNameRegexExclude(context.getProperty(FILTER_COMPONENT_NAME_EXCLUDE).evaluateAttributeExpressions().getValue());
final String[] targetEventTypes = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_EVENT_TYPE).evaluateAttributeExpressions().getValue(), ','));
if(targetEventTypes != null) {
for(String type : targetEventTypes) {
final String[] targetEventTypesExclude = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_EVENT_TYPE_EXCLUDE).evaluateAttributeExpressions().getValue(), ','));
if(targetEventTypesExclude != null) {
for(String type : targetEventTypesExclude) {
final String[] targetComponentIds = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_COMPONENT_ID).evaluateAttributeExpressions().getValue(), ','));
if(targetComponentIds != null) {
consumer.addTargetComponentId(targetComponentIds);
final String[] targetComponentIdsExclude = StringUtils.stripAll(StringUtils.split(context.getProperty(FILTER_COMPONENT_ID_EXCLUDE).evaluateAttributeExpressions().getValue(), ','));
if(targetComponentIdsExclude != null) {
consumer.addTargetComponentIdExclude(targetComponentIdsExclude);
代码示例来源:origin: org.ligoj.bootstrap/bootstrap-core
this.headers = StringUtils.stripAll(headers);
this.clazz = beanType;
内容来源于网络,如有侵权,请联系作者删除!