作为一名资深的开发人员,不会不知道VB.NET这门功能强大的语言。我们51CTO也特地开设一个专题对这门语言的概念及应用进行了详细的介绍。我们今天先来了解一下VB.NET串联运算符的相关应用技巧,提高自己对这门语言的认知程度。
VB.NET串联运算符将多个字符串联接为一个字符串。有两种串联运算符:+ 和 &.这两种VB.NET串联运算符都执行基本的串联运算,如下面的示例所示。
Visual Basic
Dim x As String = "Con" & "caten" & "ation"
Dim y As String = "Con" + "caten" + "ation"
' The preceding
statements set both x and y to "Concatenation".
这两种运算符还可以串联 String 变量,如下面的示例所示。
Visual Basic
Dim a As String = "abc"
Dim d As String = "def"
Dim z As String = a & d
Dim w As String = a + d
' The preceding statements set both z and w to "abcdef".
两种VB.NET串联运算符之间的区别更多http://www.cnblogs.com/rqialisvbs/
如果您对字符串执行大量操作(如串联、删除或替换),则通过 System.Text 命名空间中的 StringBuilder 类可能会提高性能。该类采用额外指令来创建和初始化 StringBuilder 对象,并且使用其他指令将其最终值转换为 String,但此时您可能恢复使用 StringBuilder,因为它的执行速度更快。
利用两种VB.NET串联运算符方法讲解
精选 翻译
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Scala 运算符Scala
-
vb.net内部字符串函数 vb中字符串运算符
vba 运算符
vb.net内部字符串函数 字符串连接 字符串 运算符 -
vb.net 调用类的方法 vb.net function
'判断该窗体是否已经打开 Public Function OpenForm(ByVal myform As Form, ByVal MdiForm As Form) As Boolean Dim form As Form For Each form In MdiForm.MdiChildren
vb.net 调用类的方法 vb.net integer function string