简体   繁体   English

StringUtils.split()返回空字符串?

[英]StringUtils.split() returns an empty string?

Java中的StringUtils.split函数可以返回空字符串作为输入,而不是空字符串吗?

According to Doc, NO. 根据Doc,没有。 Only a null input string will return null . 只有null输入字符串将返回null

There are three versions of StringUtils.split() : StringUtils.split()有三个版本:

Splits the provided text into an array, using whitespace as the separator 使用空格作为分隔符,将提供的文本拆分为一个数组

public static String[] split(String str)

Splits the provided text into an array, separator specified. 将提供的文本拆分为指定分隔符的数组。 This is an alternative to using StringTokenizer. 这是使用StringTokenizer的替代方法。

public static String[] split(String str, char separatorChar)

Splits the provided text into an array, separators specified. 将提供的文本拆分为一个数组,并指定分隔符。 This is an alternative to using StringTokenizer. 这是使用StringTokenizer的替代方法。

public static String[] split(String str, String separatorChars)

No , it will not return empty String "" for non-empty String. 不,它不会为非空字符串返回空字符串“”。 i believe you are talking about string with zero length "" , not about null. 我相信您是在谈论零长度为“”的字符串,而不是null。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM