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.
@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.
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,077
Most Valuable Professional