Hi Suraj
You can use this code given below:
global class classname implements Database.Batchable<sObject>{
global Database.QueryLocator start(Database.BatchableContext batchcontext){
String query = ‘select id,name from Account’;
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext batchcontext,list<Account> scope){
for(Account a:scope){
a.name = a.name.removeEnd(‘stringname’);// If you appended string at last
a.name = a.name.removeStart(‘stringname’);//If you appended String at start
update scope;
System.debug(scope);
}
global void finish(Database.BatchableContext batchcontext){}
}
Hope it may help