Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

hsin Yang
hsin Yang
1,014 Points

java split "\\"

Is it possible to split "\" in java? For example: Hi\123\trydata.tt , and I want to get the parts of "Hi" "123" "trydata.tt" The code I use public class test{

public static void main(String[] args){

String s = "C:\\Christine Practice Images\\A1 - 10X.tif";
String[] parts = s.split("\\");
for(int i = 0; i < parts.length ; i++ ){

System.out.println(parts[i]);
}

} }

this doesn't allow me to separate into parts...can anyone help me with the regular expression to split?