How to parse a String help

I'm trying to find an easy way to parse a string like this

String, brand,model, number;

String toParse=(Sony)(VZ-12324)(1);

Is there a simple way of parsing the string to the "(" and ")" are omitted and brand=Sony;

model=VZ-12324);

number="1";

?

[289 byte] By [blackmagea] at [2007-11-27 10:51:46]
# 1

You can use StringTokenizer. I think there is a better method in JDK 1.5 and later, but I am old fashioned.

- Saish

Saisha at 2007-7-29 11:33:24 > top of Java-index,Java Essentials,Java Programming...
# 2

String toParse = "(Sony)(VZ-12324)(1)";

String[] parts = toParse.split("[()]");

String brand = parts[1];

String model = parts[3];

int number = Integer.parseInt(parts[5]);

System.out.println(brand);

System.out.println(model);

System.out.println(number);

dwga at 2007-7-29 11:33:24 > top of Java-index,Java Essentials,Java Programming...