Problem with String.Split() method

Java verion: 1.5

Hi,

I have the following:

String fileName="test.jpg";

String[] tokens = fileName.split(".");

System.out.println("array length = " + tokens.length);

for (int i = 0; i < tokens.length; i++) {

System.out.println(tokens);

}

I'm getting the following output:

array length = 0

where I would expect it to split the String value creating two array values "test" and "jpg".

is there a problem using a "." as the Split argument?

Thanks in advance.

[551 byte] By [StrutFoola] at [2007-10-2 21:05:30]
# 1
split("\\.")The dot is a special character, meaning "any single character". For a literal dot, you have to escape it with the backslash.
jverda at 2007-7-13 23:50:48 > top of Java-index,Java Essentials,New To Java...