首页 > 代码库 > Lua中..和#运算符的用法

Lua中..和#运算符的用法

Lua中..和#运算符的用法

技术分享

样例

试试以下的样例就明确了在Lua编程语言提供的其它运算符:

a = "Hello "
b = "World"
print("Concatenation of string a with b is ", a..b )
print("Length of b is ",#b )
print("Length of b is ",#"Test" )


当建立并运行上面的程序它会产生下面结果

Concatenation of string a with b is  Hello World
Length of b is  5
Length of b is  4


Lua中..和#运算符的用法