# String.duplicate - syntax suggestion

**URL:** <https://forum.elixirforum.com/t/string-duplicate-syntax-suggestion/5039>\
**Category:** Discussions\
**Tags:** book-programming-elixir, syntax\
**Created:** [May 11, 2017, 5:02pm UTC](https://forum.elixirforum.com/t/string-duplicate-syntax-suggestion/5039 "2017-05-11T17:02:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siel](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/siel/32/8739_2.png) [@Siel](https://forum.elixirforum.com/u/Siel)\
**Post date:** [May 11, 2017, 5:02pm UTC](https://forum.elixirforum.com/t/string-duplicate-syntax-suggestion/5039/1 "2017-05-11T17:02:47Z")

</div>

Hi everyone, first topic here! currently I’m finishing the ‘Programming Elixir 1.3’ book and I wondered about something…

The `String.duplicate\2` function name is not clear… I say this because, at least in my point of view when I say duplicate it automatically referts to make it twice (What’s the meaning of duplicate 3 times ??)

So `String.duplicate("a")` would return `"aa"`

It would be something like `String.replicate\2` or `String.repeat\2` (Replicate n-times or repeat n-times).

I hope I get understood, English isn’t my native language and I’m just learning Elixir at the moment.

Thanks for the wonderful community.

Kisses to everyone 😃

---

<div class="post-metadata">

**Author:** ![OvermindDL1](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/32/2677_2.png) [@OvermindDL1](https://forum.elixirforum.com/u/OvermindDL1)\
**Post date:** [May 11, 2017, 5:07pm UTC](https://forum.elixirforum.com/t/string-duplicate-syntax-suggestion/5039/2 "2017-05-11T17:07:47Z")

</div>

As a native English speaker it makes sense to me, it is used as a verb (where your usage seems to be as a noun):

```elixir
verb
ˈd(y)o͞opləˌkāt/
1.
make or be an exact copy of.
"a unique scent, impossible to duplicate or forget"
synonyms:	copy, photocopy, xerox, reproduce, replicate, reprint, run off; 

```

And since it takes an integer number to be the number of times to duplicate it it makes sense to me, although perhaps that number should default to `2` would make sense.

---

<div class="post-metadata">

**Author:** ![Hal9000](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/hal9000/32/1915_2.png) [@Hal9000](https://forum.elixirforum.com/u/Hal9000)\
**Post date:** [May 11, 2017, 5:24pm UTC](https://forum.elixirforum.com/t/string-duplicate-syntax-suggestion/5039/3 "2017-05-11T17:24:36Z")

</div>

I never thought of it before, but I think he is right.

Hal
