📜  java字符串替换位置的字符 - Java代码示例

📅  最后修改于: 2022-03-11 14:52:48.604000             🧑  作者: Mango

代码示例1
String str = in.nextLine();    //Original String
char cr = in.next().charAt(0); // character to replace
int index = in.nextInt();    // Index where replaced
str = str.substring(0, index) + cr + str.substring(index + 1);// modified string