Replace function in String using Apex in Salesforce

Sample Code:

String str = 'test';
system.Debug('Replace value is ' + str.replace('t','$').replace('e', '*').replace('s', '%'));

Output:


Cheers!!!

No comments:

Post a Comment