Get addition of strings in Julia using concatenate operator – * operator
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
Please Login to comment...