Could someone show me how I would input a string into a method and it would select one letter of the string and change it to a letter I choose. For example, I would call ChangeString(hello) and it would return a string that changed one letter like "Hel_o".
(Edit) I’ve tried setCharAt() and putting in a random number, but i dont know how to make it change just one letter and leave the rest of the string alone and give me the changed letter and the new string.
(Edit 2) Alright I seem to have figured somthing. Thanks everyone!
This isn’t homework, This is an app I’m working on in Eclipse for the market! I just needed Help.
First, convert the string into a character array. Then, generate a random integer between 0 and the length of the string. Set the character at that array index to an underscore. Return a new string with the modified character array.