
How to remove or replace character from a string?

SELECT REPLACE('Data is now going to change!','change','')
Here you are removing change from your string ?'Data is now going to change!? by replacing 'change' to the blank space.
You can also use REPLACE() for replacing any content in database. Here is example?
Example :
public class RemoveCharSql {
public static void main(String[] args) {
Connection connection = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "test";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";
try {
Class.forName(driver).newInstance();
connection = DriverManager.getConnection(url + dbName, userName,
password);
Statement statement = connection.createStatement();
statement.executeUpdate("Update user Set name = replace(name,'mandy' , 'Raj')");
System.out.println("Updated");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Description: user is your table and you are going to replace name ?mandy? to ?Raj?. You can also remove it by putting Blank space ??.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.