Java: Split string when an uppercase letter is found

前端 未结 7 973
醉梦人生
醉梦人生 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 15:51

    Try this;

    static Pattern p = Pattern.compile("(?=\\p{Lu})");
    String[] s1 = p.split("thisIsMyFirstString");
    String[] s2 = p.split("thisIsMySecondString");
    
    ...
    

提交回复
热议问题