Maybe
```
else
    result.replace(pos, 1, decimalPoint);
```