Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Data Structures Organizing Data Splitting Strings

1 Answer

Daniel Hartin
Daniel Hartin
18,106 Points

Hi

the docs for the split method are here http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String)

you will see the method returns a string array so firstly you should define your return type as String[], in your method you then need to call .split() on the mBody string. You will see from the docs their is a method which takes a regex expression as a parameter, you should use this method placing the regular expression shown in the question text inside double quotes.

I hope this was enough of a hint without just giving you the answer, if you're still struggling let mek know and I can produce shows examples to explain better.

Thanks Daniel