Hi, I have a simple question regarding Strings. I'm working on a short program that will require me to remove a single character from a string and replace it with another character, if that makes sense.
So basically If I had the string: "dogs"
I want to be able to replace the second character with a 'u' to look like this: "dugs"
What is the best way to do that?
I took a look through the String Methods as listed on oracle.com and I didn't find anything that does this. I did find the "replace(char oldChar, char newChar) " method, but from the looks of it, it replaces all instances of a given character. What I want is something that will replace only the one character specified. I'm sure that this could be done fairly painlessly via concatenation, But I thought I would ask first if there was a better way.
Any help is appreciated