If don't want to convert the StringBuilder
to a String
or you need to keep using it/preserve it, then you could do something like this...
for (int index = 0; index < sb.length(); index++) {
if (sb.charAt(index) == '-') {
sb.setCharAt(index, '/');
}
}
If you don't care then you could do something like...
String value = sb.toString().replace("-", "/");