| | |
String.split("\\"); throws PatternSyntaxException?
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: May 2008
Posts: 122
Reputation:
Solved Threads: 5
JAVA Syntax (Toggle Plain Text)
String line = "Extracting from E:\\Junk\\morejunk\\file.txt"; System.out.println(line); //prints: Extracting from E:\Junk\morejunk\file.txt String[] splitPath = line.split("\\"); //exception thrown here String folder = splitPath[splitPath.length-2]; System.out.println(folder);
•
•
•
•
Exception in thread "AWT-EventQueue-0" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
Any suggestions why it wont accept "\\" as a pattern which is correctly syntaxed?
![]() |
Similar Threads
- Something about String.split("-"); problem (Java)
- string split (C#)
- Replacing '\' with "\\" for strings (C)
Other Threads in the Java Forum
- Previous Thread: Adding Articles to database
- Next Thread: Please help me to complete coding this program
Views: 482 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for Java
android api apple applet application arguments array arrays automation binary bluetooth c# capture chat chatprogramusingobjects class classes client code color component count database design draw eclipse eclipsedevelopment encryption error event exception file fractal game givemetehcodez graphics gridlayout gui helpwithhomework high html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jmf jni jpanel julia keyword linux list loop macintosh map method methods mobile netbeans newbie number object oracle os print problem producer program programming project projectideas read recursion replaysolutions scanner screen server set size sms socket sort sql string swing test threads time transfer transforms tree ui unicode windows





