+和&运营商 [英] + and & operators

查看:76
本文介绍了+和&运营商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

+之间的区别是什么?和&加入字符串时的运算符?

Thanx!

What is the difference between "+" and "&" operator when joining strings?
Thanx!

推荐答案

" Domac" < dd@dd.cc> schrieb:
"Domac" <dd@dd.cc> schrieb:
+和+之间的区别是什么?和&加入字符串时的操作符?
What is the difference between "+" and "&" operator when joining strings?




您是否已阅读有关这些操作符的文档?


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http:// classicvb.org/petition/>



Did you already read the documentation on these operators?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


2006年6月29日星期四13:51:07 +0200 Domac< dd@dd.cc>写道:
On Thu, 29 Jun 2006 13:51:07 +0200 Domac <dd@dd.cc> wrote:
* From:*" Domac" < dd@dd.cc>
*日期:*星期四,2006年6月29日13:51:07 +0200

+之间的区别是什么?和&加入
字符串的运算符?
*From:* "Domac" <dd@dd.cc>
*Date:* Thu, 29 Jun 2006 13:51:07 +0200

What is the difference between "+" and "&" operator when joining
strings?




加入两个真正的字符串时差别不大。

" aaa" +bbb会得到与aaa相同的结果。 &安培; " BBB"即aaabbb


但是,如果一个表达式是一个数字而一个是一个字符串,那么事情就不那么清楚了......


" 5" + 10将给出数字15.5。转换为

fly上的数字。


而5 &安培; 10将给出字符串510。 10在运行中转换为

字符串。


+应该只用于添加数字,&应该用来

连接字符串。



Not much difference when joining two real strings.
"aaa" + "bbb" would give the same result as "aaa" & "bbb" i.e. "aaabbb"

However, if one expression is a number and one a string then things are
less clear...

"5" + 10 will give the number 15. The "5" is converted to a number "on the
fly".

Whereas "5" & 10 will give the string "510". The 10 is converted to a
string "on the fly".

+ should really only be used to add numbers, and & should be used to
concatenate strings.


非常感谢!


" Domac" < dd@dd.cc>在留言中写道

新闻:un *************** @ TK2MSFTNGP04.phx.gbl ...
Thanks a lot!

"Domac" <dd@dd.cc> wrote in message
news:un***************@TK2MSFTNGP04.phx.gbl...
有什么区别在+之间和&加入字符串时的操作符?

Thanx!
What is the difference between "+" and "&" operator when joining strings?
Thanx!



这篇关于+和&amp;运营商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆