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:
I have the same question (0)
  • 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,024 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,024 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard