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