1// remove last character from string in java
2public class SubstringDemo
3{
4 public static void main(String[] args)
5 {
6 String strInput = "Flower Brackets!";
7 String strOutput = strInput.substring(0, strInput.length() - 1);
8 System.out.println(strOutput);
9 }
10}
1
2String str = "abcdDCBA123";
3String strNew = str.replace("a", ""); // strNew is 'bcdDCBA123'
4