# How to link the elements of array into a string

**URL:** <https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 5, 2019, 9:40am UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735 "2019-11-05T09:40:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yan](https://avatars.discourse-cdn.com/v4/letter/y/3e96dc/32.png) [@Yan](https://discourse.julialang.org/u/Yan)\
**Post date:** [November 5, 2019, 9:40am UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735/1 "2019-11-05T09:40:43Z")

</div>

x=[“j”,“u”,“l”,“i”,“a”]

such as: string?(x) into “julia”

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [November 5, 2019, 9:43am UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735/2 "2019-11-05T09:43:06Z")

</div>

Hi there,

the function you are looking for is called `join`.

```julia
julia> x=["j","u","l","i","a"]
5-element Array{String,1}:
 "j"
 "u"
 "l"
 "i"
 "a"

julia> join(x)
"julia"

```

Alternatively, `string(x...)` and `reduce(*,x)` work as well.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [November 5, 2019, 9:44am UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735/3 "2019-11-05T09:44:54Z")

</div>

There is also `join`:

```julia
help?> join(x)
  join([io::IO,] strings, delim, [last])

  Join an array of strings into a single string, inserting the given
  delimiter between adjacent strings. If last is given, it will be
  used instead of delim between the last two strings. If io is
  given, the result is written to io rather than returned as as
  a String.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> join(["apples", "bananas", "pineapples"], ", ", " and ")
  "apples, bananas and pineapples"

julia> join(["j", "u", "l", "i", "a"])
"julia"

```

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [November 5, 2019, 9:45am UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735/4 "2019-11-05T09:45:25Z")

</div>

Sorry, @fredrikekre I updated my post to include `join` before you posted yours 🙂

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [November 5, 2019, 9:47am UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735/5 "2019-11-05T09:47:17Z")

</div>

BTW, for better readability use backticks `` short code goes here `` or triple backticks ```` longer codeblock goes here ```` to enable syntax highlighting etc. for you code.

---

<div class="post-metadata">

**Author:** ![Yan](https://avatars.discourse-cdn.com/v4/letter/y/3e96dc/32.png) [@Yan](https://discourse.julialang.org/u/Yan)\
**Post date:** [December 1, 2019, 4:58am UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735/6 "2019-12-01T04:58:51Z")

</div>

> [@Yan](#):
>
> x=[“j”,“u”,“l”,“i”,“a”]

![image](https://global.discourse-cdn.com/julialang/original/3X/f/5/f538a70ec9b0842de51cc7342e95b1564e2c00de.png)

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [December 1, 2019, 5:49am UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735/7 "2019-12-01T05:49:44Z")

</div>

You need to interpolate global variables with $ when benchmarking with BenchmarkTooks.jl

---

<div class="post-metadata">

**Author:** ![Yan](https://avatars.discourse-cdn.com/v4/letter/y/3e96dc/32.png) [@Yan](https://discourse.julialang.org/u/Yan)\
**Post date:** [December 1, 2019, 12:16pm UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735/8 "2019-12-01T12:16:51Z")

</div>

> [@carstenbauer](#):
>
> x=[“j”,“u”,“l”,“i”,“a”]

![image](https://global.discourse-cdn.com/julialang/original/3X/6/6/66669e318c133ac76169719e745ff826d44e9505.png)

---

<div class="post-metadata">

**Author:** ![mantzaris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mantzaris/32/3852_2.png) [@mantzaris](https://discourse.julialang.org/u/mantzaris)\
**Post date:** [July 23, 2020, 4:18am UTC](https://discourse.julialang.org/t/how-to-link-the-elements-of-array-into-a-string/30735/9 "2020-07-23T04:18:02Z")

</div>

An extra use case of `join(x)` over the use of the splat operator for the string concatenation is that `join(x,',')` can also let you include a delimiter (separator)
