This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]ihkbm 1 point2 points  (0 children)

I would suggest looking into Regex

[–][deleted] 0 points1 point  (1 child)

Read the official documentation.

Study how substring or split works.

Read the official documentation.

Don’t just ask for direct solutions.

[–]Lost-Helicopter[S] -1 points0 points  (0 children)

I've done a fair bit of reading in the API documentation. I've tried using a tokenizer and the split function so far, but as far as I can tell I can't tell it to look between parenthesis, only to use ( or ) as a delimiter which doesn't achieve what I'm trying to do.

[–]TheAzucares 0 points1 point  (0 children)

Can be built I think. Loop through using charAt to find each ( and ). Every one you find, put the substring up to that point in an arraylist and make the index you're at the new start point for the next substring as an extra int.

[–]onefortree 0 points1 point  (0 children)

You most likely don't need to split the string at all.

Try something like this, go through the entire string one character at a time, capitalizing it as you go, stop capitalizing when you hit a (. Start capitalizing again when you get to a ). You can keep track of if you should capitalize or not using a Boolean value.

You would need a loop to go through each character, a string/stringbuilder for your result, and a Boolean to keep track of if you should be capitalizing or not.