web
You’re offline. This is a read only version of the page.
close
Skip to main content
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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Tom Macfarlan – Community Spotlight

We are honored to recognize Tom Macfarlan as our Community Spotlight for October…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 885 Most Valuable Professional

#2
developerAJ Profile Picture

developerAJ 571

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 352 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading complete