MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / switchLetters

Method switchLetters

Programs/SwitchingLetters.java:22–24  ·  view source on GitHub ↗
(int index1, int index2, String sentence)

Source from the content-addressed store, hash-verified

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}

Callers 1

mainMethod · 0.95

Calls 1

lengthMethod · 0.80

Tested by

no test coverage detected