Question: code in java Replace the character in the string at the n index with a '*' ifthe string is long enough to have a character
code in java
Replace the character in the string at the n index with a '*' ifthe string is long enough to have a character at the n index. Ifthe string does not have enough characters, leave the Stringas-is.
replaceCharAtIndex("A String", 0) ? "* String"
replaceCharAtIndex("*****", 3) ? "*****"
replaceCharAtIndex("A String", 1) ? "A*String"
public String replaceCharAtIndex(String s, int n) {
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
