how to set a char to a string index in java
str = str.substring(0, index) + " " + str.substring(index + 1);
how to set a char to a string index in java
str = str.substring(0, index) + " " + str.substring(index + 1);
java string replace character at position
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
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us