web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to delete the last...
Power Automate
Answered

How to delete the last two characters in a text

(0) ShareShare
ReportReport
Posted on by 49

Hi All,

 

I have this web scraping flow, I need to pass the data from varCity to trim the last two characters. Any suggestions on how to properly do it?

 

Actual value sample:

varCity = Los Angeles CA

 

I need to remove the CA at the end and if possible can I transfer it to Compose. I also need that CA to be passed on for usage.

 

Please help. Thank you 🙂

 

Mark_Castro_0-1594847851623.png

 

Categories:
  • Verified answer
    abm abm Profile Picture
    33,004 Most Valuable Professional on at

    Hi @Mark_Castro 

     

    Here it is

     

    image.png

     

     

    The expression I used above is as follows:

     

    substring(outputs('Compose'),0,sub(length(outputs('Compose')),2))
     
    Thanks
  • Mark_Castro Profile Picture
    49 on at

    Hi @abm 

     

    It worked! Thank you. 

     

    A follow-up question, what part of the syntax should I change, and what function to use? To retain the last two character I will need that value for the State. 🙂

  • Verified answer
    abm abm Profile Picture
    33,004 Most Valuable Professional on at

    Hi @Mark_Castro 

     

    Here it is

     

    substring(outputs('Compose'),sub(length(outputs('Compose')),2), 2)
     
    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 377

#2
11manish Profile Picture

11manish 292 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 128

Last 30 days Overall leaderboard