Skip to main content
Community site session details

Community site session details

Session Id : 9Wa3aiXNy8DOorfC9xQxD7
Power Apps - Building Power Apps
Answered

PowerApps remove last part of string

Like (0) ShareShare
ReportReport
Posted on 1 Mar 2023 16:43:36 by 70

Hello,

 

in PowerApps forms, i have a string /sites/SkoleniSFRB/Reporty/DataSP/01.jpg. I need to remove part 01.jpg so string remains.

 

Can please someone help me? 

 

Thank you.

  • Krentor Profile Picture
    70 on 01 Mar 2023 at 16:57:21
    Re: PowerApps remove last part of string

    Thank you very much! That helped me. Love this community. 

     

    Regards,
    Jakub

  • TheRobRush Profile Picture
    11,121 Moderator on 01 Mar 2023 at 16:53:19
    Re: PowerApps remove last part of string

    Use the method I outlined in my response, it will work regardless of the file name, or length of rest of fullpathname etc.

  • JmeBrey Profile Picture
    55 on 01 Mar 2023 at 16:49:03
    Re: PowerApps remove last part of string

    Yes , a few ways to achieve this - you will have to select which is the best option for you, for example if the string can end with different file names, you may need to adjust the formula accordingly.

     

    Substitute("/sites/SkoleniSFRB/Reporty/DataSP/01.jpg", "/01.jpg", "")

     

     

     

    Replace("/sites/SkoleniSFRB/Reporty/DataSP/01.jpg", Right("/sites/SkoleniSFRB/Reporty/DataSP/01.jpg", 6), "")

     

    This formula uses the "Right" function to extract the last 6 characters (which is the length of "01.jpg"), and then uses the "Replace" function to replace those characters with an empty string, effectively removing them from the original string

     

    Left("/sites/SkoleniSFRB/Reporty/DataSP/01.jpg", Len("/sites/SkoleniSFRB/Reporty/DataSP/01.jpg")-6)

     

     

    This final one is good if you want to remove everything after the last "/" regardless what the text is

    Concat(Split("/sites/SkoleniSFRB/Reporty/DataSP/01.jpg", "/"), "/", CountRows(Split("/sites/SkoleniSFRB/Reporty/DataSP/01.jpg", "/"))-1)



  • Verified answer
    TheRobRush Profile Picture
    11,121 Moderator on 01 Mar 2023 at 16:47:26
    Re: PowerApps remove last part of string

    where Label10 is our string

    Concat(FirstN(Split(Label10.Text,"/"),CountRows(Split(Label10.Text,"/"))-1),Result,"/")&"/"

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete