java string swap two characters

Solutions on MaxInterview for java string swap two characters by the best coders in the world

showing results for - "java string swap two characters"
Fabian
17 Jan 2017
1String originalString = "abcde";
2//Strings are immutable
3char[] c = originalString.toCharArray(); 
4//Swap
5char temp = c[0];
6c[0] = c[1];
7c[1] = temp;
8//Result
9String swappedString = new String(c);
queries leading to this page
swap characters in string java functionswap two charcters in javastringbuilder swap charactersjava string swap charactersjava swap string charactersswap two characters in string javaswap a character in string javajava swap characters in stringhow to swap character in string javahow to swap characters in a string in javareplace two characters in string javaswap to characters in string in javaswap string characters in javaswap two char in string javaswap 2 chars in a substringjava method for swapping characters in a stringswap two letters in a word in javahow to swap string characters in javaswap charcters in two strings javamethod or function that swaps two string characters in javacan we swap characters of string in javaswap two characters in a string javastring character swap in javaswapping letters javaswap characters string javaswap characters in string javahow to swap two characters in a string in javaswap two string in javaswap string in javaswap 2 strings in javaswap characters in javareplace 2 characters in string javaswap characters of a string javajava how to swap characters in a stringswap value within string javajava string swap two charactershow to swap letters in string in javajava replace char with emptyswap letters in string javahow to swap two characters in a string builder in javastring swap characters javacan we swap two characters in a string in javaswap characters in a string javaswap characters in string java cuntionhow to swap characters in string in java swapping characters in a string javahow to swap a characters in string javaswap 2 characters in a string javaswap two chars in string in javajava string swap two characters