-
Posts
1331 -
Joined
-
Last visited
Single Status Update
-
I'm supposed to write a method that acts like java.lang.String.split, except that this new method returns a String array including the delimeters. For example:
split("Java#HTML#Cpp", "#") would return "Java", "#", "HTML", "#" and "Cpp" in an array. I already done the hard part, which returns the array correctly. However, I don't how to make it work with regular expressions, such as:
split("Java#HTML$Cpp%Python", "[#$%]"). It should return:
"Java", "#", "HTML", "$", "Cpp", "%", "Python".
Any ideas?
Here is my code BTW:code:
Array- Show previous comments 2 more
-
-
fraggle said:
Assuming the assignment requires the second argument to be a regexp, if I was running the class you'd get a fail mark. What you have implemented is not a regexp.
This problem is put very early in the book, probably a mistake, as it didn't discuss regular expressions at all in the chapter. My instructor limited me to making this, not an actual regex. I kept the method naming the same though, that's why I didn't understand "regex" at first. -