Home » Java Program to toggle each word in String

Java Program to toggle each word in String

by Online Tutorials Library

Java Program to tOGGLE each word in String

We can tOGGLE each word of a string by the help of split(), toLowerCase(), toUpperCase() and substring() methods. By the help of split(“\s”) method, we can get all words in an array. To get the first character, we can use substring() or charAt() method.

Let’s see the example to tOGGLE each word in a string.

File: StringFormatter.java

File: TestStringFormatter.java

Output:

mY nAME iS kHAN i aM Tutor Aspire Team 
Next TopicJava String FAQs

You may also like