Removing last letter from name if ends with s | Community
Skip to main content
New Participant
June 9, 2022
Solved

Removing last letter from name if ends with s

  • June 9, 2022
  • 1 reply
  • 1874 views

Hi Champions,

I want to write a script to remove the last letter from First name if name ends with s.

For eg:

Dear Janis -> Dear Jani

Dear Kaspars -> Dear Kaspar

Dear Karlis -> Dear Karli

 

 Any help here is much appreciated. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

OK, sounds like Velocity is the way to go.

#set( $lead.friendlyFirstName = $lead.FirstName.replaceFirst("(?i)s$","") ) ${lead.friendlyFirstName}

 

1 reply

SanfordWhiteman
New Participant
June 9, 2022

Easily done in Velocity, but what’s the actual use case here? Did you have a bad data load?

PMarketoAuthor
New Participant
June 13, 2022

This is a salutation rule in Latvia, we intent to use local language salutation rules in email.

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
June 13, 2022

OK, sounds like Velocity is the way to go.

#set( $lead.friendlyFirstName = $lead.FirstName.replaceFirst("(?i)s$","") ) ${lead.friendlyFirstName}