Skip to main content
Level 2
6月 9, 2022 12:22 午後 UTC
解決済み

Removing last letter from name if ends with s

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. 

このトピックへの返信は締め切られました。
SanfordWhiteman
User Group Leader
6月 13, 2022 6:38 午後 UTC

OK, sounds like Velocity is the way to go.

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

 

3 の返信

SanfordWhiteman
User Group Leader
User Group Leader
6月 9, 2022 3:50 午後 UTC

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

翻訳
PMarketo作成者
Level 2
6月 13, 2022 10:34 午前 UTC

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

翻訳
SanfordWhiteman
User Group Leader
User Group Leader
6月 13, 2022 6:38 午後 UTC

OK, sounds like Velocity is the way to go.

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

 

翻訳