how to remove certain characters from a string code example

Example 1: python remove string from string

s = 'ab12abc34ba'
print(s.replace('ab', ''))

Example 2: remove from string python

"Str*ing With Chars I! don't want".replace('!','').replace('*','')

Example 3: how to find and remove certain characters from text string in python

a_string = "addbdcd"

a_string = a_string.replace("d", "")

print(a_string)

Example 4: remove charachter from string

StringBuilder sb = new StringBuilder(inputString);

Example 5: remove charachter from string

if(String.charAt(1) == String.charAt(2){
   //I want to remove the individual character at index 2. 
}