cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
neha56
New Member

How to trim the last character in string

How can I trim the last character from a string where I am concatenating the email address with ; as delimiter? I do not need the last semi-colon.

 

Any help is much appreciated.

6 REPLIES 6

Hi @neha56 

 
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
VictorIvanidze
Community Champion
Community Champion

replace(variables('mailboxAddress'),';','')
--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.
Lenfant
Regular Visitor

Hi Neha56,

 

Did you manage to resolve this?  I'm trying to do something very similar and the link suggested does not seem to work.

Hi @neha56,

did you try to use

replace(variables('mailboxAddress'),';','') 

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

This solution will replace all instances of ';' which is not quite what I wanted.  I finally opted for the solution in https://powerusers.microsoft.com/t5/General-Power-Automate/Removing-the-last-character-in-the-string...

 

This worked, albeit a small typo by me which is why it didn't work first time.

Jaco_Campher
Advocate I
Advocate I

For anyone else looking, this will only remove the trailing ; if it is there.


if(equals(last(triggerBody()['email']), ';'), substring(triggerBody()['email'], 0, add(length(triggerBody()['email']), -1)), triggerBody()['email'])

 

Replace the text in blue with your input.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (2,912)