Split the string on forward slash

后端 未结 4 1764
傲寒
傲寒 2020-12-04 01:47

I have a code which I wanted to split based on the forward slash \"/\".

Whenever I have a regex split based on \"////\" it never splits and gives me the whole string

4条回答
  •  不思量自难忘°
    2020-12-04 02:03

    There is no need to escape forward slashes. Your code works fine if you just do:

    String[] paths = path.split("/");
    

提交回复
热议问题