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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Last space in string
Power Apps
Unanswered

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
    Re: Last space in string

    @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
    68,678 Most Valuable Professional on at
    Re: Last space in string

    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
    68,678 Most Valuable Professional on at
    Re: Last space in string

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard