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 Apps / Last space in string
Power Apps
Answered

Last space in string

(0) ShareShare
ReportReport
Posted on by 204

Hi Guys,

 

Trying to figure out how to get the last space within a string and then extract all characters after the last space.

 

This is a dynamic string and not in all instances will the string have a space. I only need to extract all characters after the last space if there is a space.

 

Any help is greatly appreciated.

 

Thanks

Categories:
  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @christian12 

    This will return a Blank as there are no spaces,

     

    With({myString:"Apples,Oranges,Bananas"},
     If(IsMatch(myString, Space, Contains), Last(TrimEnds(Split(myString, " "))).Result, Blank())
    )

     

    This will return 🍌🍌🍌

     

    With({myString:"Apples,Oranges, Bananas"},
     If(IsMatch(myString, Space, Contains), Last(TrimEnds(Split(myString, " "))).Result, Blank())
    )

     

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    I think the easiest way to do what you are asking is to use a combination of Split and Last functions.

    Last(Split(<<string to extract from>>,' '))

    Split will split the string into an array based on the spaces in the string. Then Last will give you whatever follows the last space.

  • Pstork1 Profile Picture
    69,661 Most Valuable Professional on at

    I hadn't noticed that @CNT already answered this.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard