📜  使用连接运算符- *运算符在 Julia 中添加字符串

📅  最后修改于: 2022-05-13 01:54:46.425000             🧑  作者: Mango

使用连接运算符- *运算符在 Julia 中添加字符串

*是 julia 中的连接运算符,用于将不同的字符串和/或字符连接成单个字符串。

示例 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")

输出:

GeeksforGeeks
GFG gfg
GeeksforGeeks
ab
a b c

示例 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")

输出:

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