Tips Tricks Samples

Return elements from a list which contain a substring

One of the most annoying things I have found in list operations is how to only return elements that contain a value. Here is a solution:

To return entries in a list that contain "B":

1: ABCX
DEFY
ABDC
DBXY

2: Replacesubstring of B with |||
A|||CX
DEFY
A|||DC
D|||XY

3: @Right of |
||CX

||DC
||XY

4: @LeftBack of 3 at |
|

|
|

5: 4 + Original List
|ABCX
DEFY
|ABDC
|DBXY

6: @Trim and @Right of 5
ABCX
ABDC
DBXY

initiallist:="ABCX":"DEFY":"ABDC":"DBXY";
step1:=@ReplaceSubstring(initiallist; "B"; "|||");
step2:=@Right(step1; "|");
step3:=@LeftBack(step2; "|");
step4:=step3 + initiallist;
step5:=@Right(step4; "|");
step6:=@Trim(step5);