[Someone on stackoverflow](https://stackoverflow.com/questions/12134872/how-do-i-find-out-the-position-of-a-char) gave this code that finds the position of chars... Now the problem is, its a loop that searches the whole string and returns each position... Now in this code an example "pool" is used. So it returns 1 and 2

```
String s = "Pool";
int idx = s.indexOf('o');
while (idx > -1) {
System.out.println(idx);
idx = s.indexOf('o', idx + 1);
}

```

Is there a way to use both positions returned in a method and replace the chars... For instance if I wanted to replace the 'o' with 'hh' resulting in 'phhl'