Java: Split string when an uppercase letter is found

前端 未结 7 978
醉梦人生
醉梦人生 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:00

    This regex will split on Caps, omitting the first. So it should work for camel-case and proper-case.

    (?<=.)(?=(\\p{Upper}))
    
    TestText = Test, Text
    thisIsATest = this, Is, A, Test
    

提交回复
热议问题