You need to sign in to do that
Don't have an account?
Capitalize any letters in Account Name field after an apostrophe
Is it possible to create a Trigger to decapitalize any letters in Account Name field after an apostrophe if the letter following is an "S"?
Example: St. Paul'S (decapitalize it) so that it would equal St. Paul's.
We had a developer write a code to capitalize all first letters and unfortunately the developer doesn't communicate with us anymore.
This is a simple trick, you need to add a single line to replace 'S with 's
It would be
if(account.Name.endswith('\'s')) {
account.Name = account.Name.replace('\'S','\'s');
}
A working snippet
Thanks
For future reference, here is a link to all String class methods in the developer guide: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm - if you're looking to do anything like this in the future, the functions needed should be in here.