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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to remove a substr...
Power Apps
Answered

How to remove a substring from string.

(0) ShareShare
ReportReport
Posted on by

Hi all, 

 

I have the following string which is "A|B|C|D" and trying to remove a substring without losing the structure as I read them into a collection when I split them with "|". 

 

My question is How do I remove a substring( It can be "A" or "B" or "C") without altering the "|" in the structure. 

 

Note : The substring is a parameter ( This can be "A" or "B" or "C"). 

 

I am not sure if this is correct, But tried with Forall formula and reconstructing the string using concatenate.

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    You can approach it from either the String perspective or the resulting split.

     

    For example, with the split, you can use:

    Filter(
     Split("A|B|C|D", "|"),
     !(Result="B")
    )

    This would return your Split without the B item.

     

    Similarly, you can turn it back into a string if you just want to alter the string value.

    Ex:

    Concat(
     Filter(
     Split("A|B|C|D", "|"),
     !(Result="B")
     ),
     Result & "|"
    )

    The above would produce "A|C|D|"

     

    And of course, you can just alter the string directly if that fits the scenario.

    Ex.

    Substitute("A|B|C|D", "|B", "")

    That would produce: "A|C|D"

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    on at

    @RandyHayes , Thank you. This worked!

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard