Skip to main content

Notifications

Community site session details

Community site session details

Session Id : J5jTtuRHsNx4Cg7mZkygPi
Power Apps - Building Power Apps
Answered

How to remove a substring from string.

Like (0) ShareShare
ReportReport
Posted on 13 Sep 2022 17:05:24 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:
  • Community Power Platform Member Profile Picture
    on 13 Sep 2022 at 18:20:15
    Re: How to remove a substring from string.

    @RandyHayes , Thank you. This worked!

  • Verified answer
    RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 13 Sep 2022 at 17:10:37
    Re: How to remove a substring from string.

    @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.

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…

Kudos to the March 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,077 Most Valuable Professional

Leaderboard
Loading started