String Handling and StringBuffer - ISC Class 12 Computer Science Notes, Diagrams and Solved Questions
Use Java's String and StringBuffer classes for higher-order text problems: editing text in place, splitting sentences into word arrays, sorting words and letters, and transforming or encoding words.
In this chapter
Recall the String methods used in bigger problems
Create and grow a StringBuffer with append
Edit text with insert, delete, setCharAt, replace and reverse
Choose between String and StringBuffer, and explain why + in a loop is slow
Split a sentence into a word array and sort it
Sort the letters of a word and test for anagrams
Write word transformations such as Pig Latin and letter swaps