Java: Split string when an uppercase letter is found

前端 未结 7 936
醉梦人生
醉梦人生 2020-11-27 15:29

I think this is an easy question, but I am not able to find a simple solution (say, less than 10 lines of code :)

I have a String such as \"thisIs

相关标签:
7条回答
  • 2020-11-27 16:03

    Since String::split takes a regular expression you can use a look-ahead:

    String[] x = "thisIsMyString".split("(?=[A-Z])");
    
    0 讨论(0)
提交回复
热议问题