How to prevent java.lang.String.split() from creating a leading empty string?

后端 未结 9 1371
天命终不由人
天命终不由人 2020-11-27 05:50

passing 0 as a limit argument prevents trailing empty strings, but how does one prevent leading empty strings?

for instance

String[] test =          


        
9条回答
  •  悲哀的现实
    2020-11-27 06:07

    You can only add statement like if(StringUtils.isEmpty(string)) continue; before print the string. My JDK version 1.8, no Blank will be printed. 5 this program gives me problems

提交回复
热议问题