java string replace character at position

Solutions on MaxInterview for java string replace character at position by the best coders in the world

showing results for - "java string replace character at position"
Davide
20 Feb 2019
1String str = in.nextLine();	//Original String
2char cr = in.next().charAt(0); // character to replace
3int index = in.nextInt();	// Index where replaced
4str = str.substring(0, index) + cr + str.substring(index + 1);// modified string
5