作为一名资深的开发人员,不会不知道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,因为它的执行速度更快。