As others have already said, there is no performance difference between the two. You can convince yourself of this by looking at the source. As you can see below, the two are nigh on identical.
String.charAt()
public char More ...charAt(int index) {
if ((index < 0) || (index >= count)) {
throw new StringIndexOutOfBoundsException(index);
}
return value[index + offset];
}
StrringBuilder.charAt()
public char charAt(int index) {
if ((index < 0) || (index >= count))
throw new StringIndexOutOfBoundsException(index);
return value[index];
}
In other words, use whatever you already have. If you have a String, use the String, if you have a StringBuilder, use the StringBuilder. The cost of converting from one object to the other will vastly outweigh any performance difference between these two methods.