Join an array of strings into a single string in Julia – join() Method

The join() is an inbuilt function in julia which is used to join an array of strings into a single string. The specified delimiter is used to insert in between the returned strings.

Syntax:
join([io::IO, ] strings, delim, last)

Parameters:

  • [io::IO, ] strings: Specified string.
  • delim: Specified delimiter.
  • last: If last is given than this last parameter is interted in between the last two strings.

Returns: It returns a new single string.

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

# Julia program to illustrate 
# the use of String join() method
  
# Joining an array of strings into a single string.
println(join(["Geeks", "for", "Geeks"]))
println(join(["Geeks", "for", "Geeks"], "-"))
println(join(["Geeks", "for", "Geeks"], "+"))
println(join(["Geeks", "for", "Geeks"], "-", "+"))
println(join(["Geeks", "for", "Geeks", "is", "CSE", "portal"], "-", "+"))

chevron_right


Output:

GeeksforGeeks
Geeks-for-Geeks
Geeks+for+Geeks
Geeks-for+Geeks
Geeks-for-Geeks-is-CSE+portal

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Julia program to illustrate 
# the use of String join() method
  
# Joining an array of strings into a single string.
println(join(["1", "2", "3"]))
println(join(["1", "2", "3"], "-"))
println(join(["1", "2", "3"], "+"))
println(join(["1", "2", "3"], "-", "+"))
println(join(["1", "2", "3", "4", "5", "6"], "-", "+"))

chevron_right


Output:

123
1-2-3
1+2+3
1-2+3
1-2-3-4-5+6



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.