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}
1String str = "abcdDCBA123";
2String strNew = str.replace("a", ""); // strNew is 'bcdDCBA123'
1def replace_(input_:str,latter:int):
2 name_ = ""
3 checkList=[]
4 for num in range(latter):
5 checkList.append(num)
6 for i in range(0, len(input_)):
7 if i not in checkList:
8 name_ = name_ + input_[i]
9 return name_
10
11name_=replace_("give hello",5)
12print(name_) #will print hello
13