Changing a normal string to camelCase

Hi,
i have to change a set of string to calmelcase i.e removing punctuations and spaces,and capitalizing the first letter of each word… Using only these string functions:
charAt(), length(), toUpperCase(), toLowerCase(). The only Character class functions are: e: isAlphabetic(), isLetter(), isSpaceChar(), isUpperCase(), isLowerCase(), toUpperCase(), toLowerCase().
Help needed urgently, thank you in advance.

This sounds like homework so you should have a try yourself and when you get stuck post your effort and ask for advice. We do not provide full code solutions :slightly_smiling_face:

2 Likes

Hello,

FAQ - Processing Foundation asks that you:

* Don’t cross-post the same thing in multiple topics.

The cross-post (related content and urgency) is in the topic here:

:)

Imagine you are the function tasked to do the conversion.

How would you do it?

One approach might be to look at each letter in the string, in order.

You might use a loop to do this.

You can use charAt() to look at each letter.

What do you need to check for each character?

You might need to know if it is a letter.

You might be interested in remembering if it is a space.

When should you capitalize a letter?

How will you record the output?

You might consider having a second empty string that you add letters to.

Do you need to add the spaces?

1 Like