Open In App

Get addition of strings in Julia using concatenate operator – * operator

Last Updated : 26 Mar, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads