本文整理了Java中org.apache.commons.lang3.StringUtils.deleteWhitespace()
方法的一些代码示例,展示了StringUtils.deleteWhitespace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StringUtils.deleteWhitespace()
方法的具体详情如下:
包路径:org.apache.commons.lang3.StringUtils
类名称:StringUtils
方法名:deleteWhitespace
[英]Deletes all whitespaces from a String as defined by Character#isWhitespace(char).
StringUtils.deleteWhitespace(null) = null
StringUtils.deleteWhitespace("") = ""
StringUtils.deleteWhitespace("abc") = "abc"
StringUtils.deleteWhitespace(" ab c ") = "abc"
[中]删除由字符#isWhitespace(char)定义的字符串中的所有空格。
StringUtils.deleteWhitespace(null) = null
StringUtils.deleteWhitespace("") = ""
StringUtils.deleteWhitespace("abc") = "abc"
StringUtils.deleteWhitespace(" ab c ") = "abc"
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Converts a class name to a JLS style class name.
*
* @param className the class name
* @return the converted name
*/
private static String toCanonicalName(String className) {
className = StringUtils.deleteWhitespace(className);
Validate.notNull(className, "className must not be null.");
if (className.endsWith("[]")) {
final StringBuilder classNameBuffer = new StringBuilder();
while (className.endsWith("[]")) {
className = className.substring(0, className.length() - 2);
classNameBuffer.append("[");
}
final String abbreviation = abbreviationMap.get(className);
if (abbreviation != null) {
classNameBuffer.append(abbreviation);
} else {
classNameBuffer.append("L").append(className).append(";");
}
className = classNameBuffer.toString();
}
return className;
}
代码示例来源:origin: simpligility/android-maven-plugin
/**
* @return the manufacturer of the device as set in #MANUFACTURER_PROPERTY, typically "unknown" for emulators
*/
public static String getManufacturer( IDevice device )
{
return StringUtils.deleteWhitespace( device.getProperty( MANUFACTURER_PROPERTY ) );
}
代码示例来源:origin: simpligility/android-maven-plugin
/**
* @return the model of the device as set in #MODEL_PROPERTY, typically "sdk" for emulators
*/
public static String getModel( IDevice device )
{
return StringUtils.deleteWhitespace( device.getProperty( MODEL_PROPERTY ) );
}
代码示例来源:origin: org.apache.commons/commons-lang3
className = StringUtils.deleteWhitespace(className);
if (className == null) {
return null;
代码示例来源:origin: alibaba/nacos
public static void main(String[] args) throws NacosException {
String expression = "CONSUMER.label.A=PROVIDER.label.A &CONSUMER.label.B=PROVIDER.label.B";
expression = StringUtils.deleteWhitespace(expression);
System.out.println(ExpressionInterpreter.getTerms(expression));
System.out.println(LabelSelector.parseExpression(expression));
}
}
代码示例来源:origin: DiUS/java-faker
private String domainName(){
return StringUtils.deleteWhitespace(name().toLowerCase().replaceAll(",", "").replaceAll("'", ""));
}
代码示例来源:origin: apache/nifi
final String nospaces = StringUtils.deleteWhitespace(connectString);
final String hostPortPairs[] = StringUtils.split(nospaces, ",", 100);
final List<String> cleanedEntries = new ArrayList<>(hostPortPairs.length);
代码示例来源:origin: DiUS/java-faker
/**
* <p>
* A lowercase username composed of the first_name and last_name joined with a '.'. Some examples are:
* <ul>
* <li>(template) {@link #firstName()}.{@link #lastName()}</li>
* <li>jim.jones</li>
* <li>jason.leigh</li>
* <li>tracy.jordan</li>
* </ul>
* </p>
* @return a random two part user name.
* @see Name#firstName()
* @see Name#lastName()
*/
public String username() {
String username = StringUtils.join(new String[]{
firstName().replaceAll("'", "").toLowerCase(),
".",
lastName().replaceAll("'", "").toLowerCase()}
);
return StringUtils.deleteWhitespace(username);
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testDeleteWhitespace_String() {
assertNull(StringUtils.deleteWhitespace(null));
assertEquals("", StringUtils.deleteWhitespace(""));
assertEquals("", StringUtils.deleteWhitespace(" \u000C \t\t\u001F\n\n \u000B "));
assertEquals("", StringUtils.deleteWhitespace(StringUtilsTest.WHITESPACE));
assertEquals(StringUtilsTest.NON_WHITESPACE, StringUtils.deleteWhitespace(StringUtilsTest.NON_WHITESPACE));
// Note: u-2007 and u-000A both cause problems in the source code
// it should ignore 2007 but delete 000A
assertEquals("\u00A0\u202F", StringUtils.deleteWhitespace(" \u00A0 \t\t\n\n \u202F "));
assertEquals("\u00A0\u202F", StringUtils.deleteWhitespace("\u00A0\u202F"));
assertEquals("test", StringUtils.deleteWhitespace("\u000Bt \t\n\u0009e\rs\n\n \tt"));
}
代码示例来源:origin: alibaba/nacos
expression = StringUtils.deleteWhitespace(expression);
代码示例来源:origin: twosigma/beakerx
private String removeWhitespaces(String pomAsString) {
return normalizeSpace(deleteWhitespace(pomAsString));
}
代码示例来源:origin: apache/incubator-pinot
private void initHllConfig(JobContext context) {
String _hllColumns = PinotOutputFormat.getHllColumns(context);
if (_hllColumns != null) {
String[] hllColumns = StringUtils.split(StringUtils.deleteWhitespace(_hllColumns), ',');
if (hllColumns.length != 0) {
HllConfig hllConfig = new HllConfig(PinotOutputFormat.getHllSize(context));
hllConfig.setColumnsToDeriveHllFields(new HashSet<>(Arrays.asList(hllColumns)));
hllConfig.setHllDeriveColumnSuffix(PinotOutputFormat.getHllSuffix(context));
_segmentConfig.setHllConfig(hllConfig);
}
}
}
代码示例来源:origin: alibaba/nacos
break;
expression = StringUtils.deleteWhitespace(expression);
代码示例来源:origin: apache/incubator-pinot
String[] hllColumns = StringUtils.split(StringUtils.deleteWhitespace(_hllColumns), ',');
if (hllColumns.length != 0) {
LOGGER.info("Derive HLL fields on columns: {} with size: {} and suffix: {}", Arrays.toString(hllColumns),
代码示例来源:origin: devnied/EMV-NFC-Paycard-Enrollment
/**
* Method used to the the card type with regex
*
* @param pCardNumber
* card number
* @return the type of the card using regex
*/
public static EmvCardScheme getCardTypeByCardNumber(final String pCardNumber) {
EmvCardScheme ret = null;
if (pCardNumber != null) {
for (EmvCardScheme val : EmvCardScheme.values()) {
if (val.pattern != null && val.pattern.matcher(StringUtils.deleteWhitespace(pCardNumber)).matches()) {
ret = val;
break;
}
}
}
return ret;
}
代码示例来源:origin: devnied/EMV-NFC-Paycard-Enrollment
/**
* Get card type by AID
*
* @param pAid
* card AID
* @return CardType or null
*/
public static EmvCardScheme getCardTypeByAid(final String pAid) {
EmvCardScheme ret = null;
if (pAid != null) {
String aid = StringUtils.deleteWhitespace(pAid);
for (EmvCardScheme val : EmvCardScheme.values()) {
for (String schemeAid : val.getAid()) {
if (aid.startsWith(StringUtils.deleteWhitespace(schemeAid))) {
ret = val;
break;
}
}
}
}
return ret;
}
代码示例来源:origin: devnied/EMV-NFC-Paycard-Enrollment
/**
* Method used to find description from ATR
*
* @param pAtr
* Card ATR
* @return list of description
*/
@SuppressWarnings("unchecked")
public static final Collection<String> getDescription(final String pAtr) {
Collection<String> ret = null;
if (StringUtils.isNotBlank(pAtr)) {
String val = StringUtils.deleteWhitespace(pAtr);
for (String key : MAP.keySet()) {
if (val.matches("^" + key + "$")) {
ret = (Collection<String>) MAP.get(key);
break;
}
}
}
return ret;
}
代码示例来源:origin: org.apache.hadoop/hadoop-hdfs
private MetricsInfo buildOpTotalCountMetricsInfo(Op op) {
return Interns.info("op=" + StringUtils.deleteWhitespace(op.getOpType())
+ ".TotalCount", "Total operation count");
}
代码示例来源:origin: devnied/EMV-NFC-Paycard-Enrollment
/**
* Method used to find ATR description from ATS (Answer to select)
*
* @param pAts
* EMV card ATS
* @return card description
*/
@SuppressWarnings("unchecked")
public static final Collection<String> getDescriptionFromAts(final String pAts) {
Collection<String> ret = null;
if (StringUtils.isNotBlank(pAts)) {
String val = StringUtils.deleteWhitespace(pAts);
for (String key : MAP.keySet()) {
if (key.contains(val)) { // TODO Fix this
ret = (Collection<String>) MAP.get(key);
break;
}
}
}
return ret;
}
代码示例来源:origin: org.apache.hadoop/hadoop-hdfs
private MetricsInfo buildOpRecordMetricsInfo(Op op, User user) {
return Interns.info("op=" + StringUtils.deleteWhitespace(op.getOpType())
+ ".user=" + user.getUser()
+ ".count", "Total operations performed by user");
}
}
内容来源于网络,如有侵权,请联系作者删除!