Question: Java String Builder Problem. I need the second input found in the StringBuilder to be converted to uppercase. The second input should be capitalized and
Java String Builder Problem.
I need the second input found in the StringBuilder to be converted to uppercase. The second input should be capitalized and if those same letters are found in the first string then they should be converted to uppercase letters. See required input and output below.
Here is what I have so far:
import java.util.Scanner; public class CaseDemo2 { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Enter some String"); StringBuilder sb = new StringBuilder(keyboard.nextLine()); System.out.println("Which letters should be converted to uppercase?"); String chars = keyboard.nextLine(); ParsingUtils.changeLetter(sb, chars); System.out.println(sb); } }
| Standard Input | |
|---|---|
aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz abcxyz |
|
Required Output
Enter a String Which characters should be converted to uppercase? AABBCCddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwXXYYZZ
| Standard Input | |
|---|---|
aaabbbcceeefghj abc |
|
Enter a String Which characters should be converted to uppercase? AAABBBCCeeefghj
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
