Java: Get last element after split

后端 未结 12 1823
慢半拍i
慢半拍i 2020-12-02 11:31

I am using the String split method and I want to have the last element. The size of the Array can change.

Example:

String one = \"Dü         


        
12条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 12:24

    You can use the StringUtils class in Apache Commons:

    StringUtils.substringAfterLast(one, "-");
    

提交回复
热议问题