Skip to content
Related Articles

Related Articles

Get addition of strings in Julia using concatenate operator – * operator
  • Last Updated : 26 Mar, 2020

The * is an concatenate operator in julia which is used to concatenate different strings and/or characters into a single string.

Syntax:
*(s::Union{AbstractString, AbstractChar}, t::Union{AbstractString, AbstractChar}…)

Parameters:

  • Union{AbstractString, AbstractChar}: Specified strings or characters

Returns: It returns a new concatenated string.

Example 1:






# Julia program to illustrate 
# the use of concatenate operator *
  
# Get concatenation of different strings 
println("Geeks" * "forGeeks")
println("GFG" * " gfg")
println("Geeks" * "for" * "Geeks")
println("a" * "b")
println("a" * " b" * " c")

Output:

GeeksforGeeks
GFG gfg
GeeksforGeeks
ab
a b c

Example 2:




# Julia program to illustrate 
# the use of concatenate operator *
  
# Get concatenation of different strings 
println("1" * "-2")
println("1" * ", 3" * ", 5")
println("2" * " 4" * " 6" * " 8")

Output:

1-2
1, 3, 5
2 4 6 8

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :