String.split() — How do I treat consecutive delimiters as one?

后端 未结 4 2072
南笙
南笙 2021-01-02 00:12

For two sample strings in variable temp such as these:

(1) \"|RYVG|111|9|\"
(2) \"|RYVG|111||9|\"

I want to do the following:



        
4条回答
  •  一整个雨季
    2021-01-02 00:27

    StringUtils split method considers the consecutive delimiters as one delimiter.

    org.apache.commons.lang.StringUtils.split("|"); 
    

提交回复
热议问题