how to split the string in java
java, split, string
Solution
`split()` function in Java accepts regular expressions. So, what you exactly need to do is to escape the backslash character twice:
String[] dir=direct.split("\\\\");
One for Java, and one for regular expressions.
Problem
how to split the string in java in Windows? I used Eg. ``` String directory="C:\home\public\folder"; String [] dir=direct.split("\"); ``` I want to know how to split the string in eg. In java, if I use `"split("\")"` , there is syntax error. thanks