+ Start a Discussion
Raghu_devRaghu_dev 

Find and replace a string on a string field

Hello all !!

I have to do a find and replace a string on a variable (string). I know there is a matcher object but I couldnt find much documentation on the usage. Any one else used this object ? or is there any other simple function to get this done. Pls help

Thanks
Raghu


Message Edited by Raghu_dev on 05-14-2008 05:45 PM
Best Answer chosen by Admin (Salesforce Developers) 
Raghu_devRaghu_dev
Thank you ckemp.

I did the following and everything is working fine.

Code:
acntSaleDet = acntSaleDet.replace('Amount $', '<br>Amount $');




All Answers

ckempckemp
Raghu,

Take a look at the Apex Developer's Guide, specifically the "Pattern and Matcher Classes" on p.185.  You'll have to use the replaceAll() or replaceFirst() methods for the Matcher object, described on p.193.
Raghu_devRaghu_dev
Thank you ckemp.

I did the following and everything is working fine.

Code:
acntSaleDet = acntSaleDet.replace('Amount $', '<br>Amount $');




This was selected as the best answer
JimPDXJimPDX
The section on "Patterns and Matchers" is now on Page 278 (bottom)