# Clear a duplicate word in a string

**URL:** <https://community.make.com/t/clear-a-duplicate-word-in-a-string/67161>\
**Category:** Questions\
**Tags:** string-functions\
**Created:** [January 22, 2025, 8:09pm UTC](https://community.make.com/t/clear-a-duplicate-word-in-a-string/67161 "2025-01-22T20:09:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garry\_V](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/garry_v/32/24933_2.png) [@Garry\_V](https://community.make.com/u/Garry_V)\
**Post date:** [January 22, 2025, 8:09pm UTC](https://community.make.com/t/clear-a-duplicate-word-in-a-string/67161/1 "2025-01-22T20:09:05Z")

</div>

Hello,  
What’s the easiest way to delete a duplicate word in a string? Does it exist a simple function for this?

As an instance, I’ve got the following string of characters :  
**\_\_\_\_\_\_ \_\_\_ banana \_\_\_ \_\_\_\_\_\_\_\_\_ \_\_ banana**

I want to clear the second “banana”

---

<div class="post-metadata">

**Author:** ![XenoMax](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/xenomax/32/9949_2.png) [@XenoMax](https://community.make.com/u/XenoMax)\
**Post date:** [January 22, 2025, 9:04pm UTC](https://community.make.com/t/clear-a-duplicate-word-in-a-string/67161/2 "2025-01-22T21:04:10Z")

</div>

> [@Garry\_V](#):
>
> What’s the easiest way to delete a duplicate word in a string? Does it exist a simple function for this?
> 
> As an instance, I’ve got the following string of characters :  
> **\_\_\_\_\_\_ \_\_\_ banana \_\_\_ \_\_\_\_\_\_\_\_\_ \_\_ banana**
> 
> I want to clear the second “banana”

Do you know what the words are ahead of time or do you went to remove any 2nd appearance of any word?

---

<div class="post-metadata">

**Author:** ![Garry\_V](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/garry_v/32/24933_2.png) [@Garry\_V](https://community.make.com/u/Garry_V)\
**Post date:** [January 22, 2025, 9:05pm UTC](https://community.make.com/t/clear-a-duplicate-word-in-a-string/67161/3 "2025-01-22T21:05:09Z")

</div>

remove any 2nd appearance of any word

---

<div class="post-metadata">

**Author:** ![XenoMax](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/xenomax/32/9949_2.png) [@XenoMax](https://community.make.com/u/XenoMax)\
**Post date:** [January 22, 2025, 9:58pm UTC](https://community.make.com/t/clear-a-duplicate-word-in-a-string/67161/5 "2025-01-22T21:58:22Z")

</div>

I came up with this:

```auto
{{join(distinct(split("apple banana orange apple grape banana orange apple apple melon orange apple grape banana orange pineapple"; space)); space)}}

```

It assumes no punctuation though. So `apple` and `apple.` would be treated separately.

You could strip out all periods first by replacing them with spaces (if you don’t mind losing punctuation), or first split your string into distinct sentences (`{{split("string"; ".")}}`) and then run them each through the above function. You could then add a period to the end of each output string and reassemble your string.

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [February 6, 2025, 10:00am UTC](https://community.make.com/t/clear-a-duplicate-word-in-a-string/67161/6 "2025-02-06T10:00:36Z")

</div>


