Skip to main content

Notifications

Community site session details
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 Super User 2025 Season 1 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 Super User 2025 Season 1 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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard