2

I need to replace Where with Where (

Replace each where+space with where+space+open bracket.

Please suggest me how to do this in Apex code. Is this possible without Matcher Class?

2

You can use the replace method:

query = query.replace(' WHERE ', ' WHERE (');
| improve this answer | |
1

Use String class method replaceAll() to do this.

related question link: How to use replaceall to remove all blank space with hypens in apex

string test = 'this is a space where';
string newtest = test.replaceAll('where ','where (');
system.debug(newtest);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.