The join() is an inbuilt function in julia that 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 then this last parameter is inserted in between the last two strings.
Returns: It returns a new single string.
Example 1:
Python
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" ], "-" , "+" ))
|
Output:
GeeksforGeeks
Geeks-for-Geeks
Geeks+for+Geeks
Geeks-for+Geeks
Geeks-for-Geeks-is-CSE+portal
Example 2:
Python
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" ], "-" , "+" ))
|
Output:
123
1-2-3
1+2+3
1-2+3
1-2-3-4-5+6
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
23 Feb, 2021
Like Article
Save Article