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:
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:
println( "1" * "-2" )
println( "1" * ", 3" * ", 5" )
println( "2" * " 4" * " 6" * " 8" )
|
Output:
1-2
1, 3, 5
2 4 6 8
Share your thoughts in the comments
Please Login to comment...