remove last char from stringbuilder code example
Example 1: how to delete last char from stringbuilder
if(sb.length() > 0){
sb.deleteCharAt(sb.length() - 1);
}
Example 2: StringBuilder java pop back
sb.setLength(sb.length() - 1);
if(sb.length() > 0){
sb.deleteCharAt(sb.length() - 1);
}
sb.setLength(sb.length() - 1);