Help to find out and remove duplicates of any text piece in a text string

Can some one suggest me a way to find out and remove duplicates of any text piece in a text string .


Like in above picture:point_up_2:
ABCD…EFGH- - - -IJKL is the text and it contains duplicates text pieces of and - - - - (dots and dashes) so when a button is clicked this complete text should be changed to ABCD.EFGH-IJKL that is all duplicates of text piece … and - - - - removed

try something like this:
(if only dots and dashes)

3 Likes

At first, make a list of all characters what you want to filter. Initilialize this list using list from csv block. > charlist
After that, when confirm clicked, for each item in list charlist, replace all text (in original text) char+char with char, while char+char disappears from text and char stays.

(char is the selected item from charlist)

Abcdd.e----fff
Abcd.e–ff
Abcd.e-f
That’s it!

2 Likes

@bodymindpower but there is no fixed number how many times dot and dashes can appear in text it depends on user or how many time a button is pressed
like - Sometime it can be ABCD.EFGH - -IJKL and sometime it can be ABCD…EFGH - -IJKL so it varies …
btw I already tried this :grin:

I am very bad at working with lists:sweat_smile:
but can try your method if it works

It should.

That’s why @bodymindpower used the While test do block.

1 Like

It does not matter how many dots and dashes exist. When the button is pressed, all but one are removed.

2 Likes

same thing, try this:


removeDuplicates.aia (2.4 KB)

1 Like

To catch such scenarios (dots and / or dashes separated by 1 or more blanks) as well:
ABCD. . . EFGH- - - - -IJKL

try this:


remove_duplicates_spaces.aia (2.6 KB)