(int index1, int index2, String sentence)
| 20 | /* Switches letters according to given indexes. */ |
| 21 | |
| 22 | public static String switchLetters(int index1, int index2, String sentence) { |
| 23 | return sentence.substring(0,index1) + sentence.charAt(index2) + sentence.substring(index1 + 1, index2) + sentence.charAt(index1) + sentence.substring(index2 + 1, sentence.length()); |
| 24 | } |
| 25 | } |