String Concatenation Operation

This section provides a quick introduction of string concatenation operation, which joins the second string to the end of the first string.

String concatenation operation is an operation that:

Here is a tutorial example showing you how string concatenation operation works:

<html>
<body>
<!-- string_concatenation.html
 - Copyright (c) 2015, HerongYang.com, All Rights Reserved.
-->
<pre>
<script language="vbscript">
   document.writeln("Hello " & "world!")
   document.writeln("649 = " & 649)
   document.writeln("True = " & True)
   document.writeln("#31-Dec-1999# = " & #31-Dec-1999#)
   document.writeln("Empty = " & Empty)
   document.writeln("Null = " & Null)
   document.writeln("Hello " + "world!")
   document.writeln("649 " + 649)
'   document.writeln("Game " + 649)
</script>
</pre>
</body>
</html>

Here is the output of this VBScript example script:

Hello world!
649 = 649
True = True
#31-Dec-1999# = 12/31/1999
Empty = 
Null = 
Hello world!
1298

The output confirms some of string concatenation operation rules:

Table of Contents

 About This Book

 Introduction of VBScript - Visual Basic Scripting Edition

 Variant Data Type, Subtypes, and Literals

 Arithmetic Operations

 Numeric Comparison Operations and Logical Operations

String Operations - Concatenation and Comparison

String Concatenation Operation

 String Comparison Operation

 Variable Declaration and Assignment Statement

 Expression and Order of Operation Precedence

 Statement Syntax and Statement Types

 Array Data Type and Related Statements

 Array References and Array Assignment Statements

 Conditional Statements - "If ... Then" and "Select Case"

 Loop Statements - "For", "While", and "Do"

 "Function" and "Sub" Procedures

 Built-in Functions

 Inspecting Variables Received in Procedures

 Error Handling Flag and the "Err" Object

 Regular Expression Pattern Match and Replacement

 scrrun.dll - Scripting Runtime DLL Library

 Creating Your Own Classes

 IE Web Browser Supporting VBScript

 IIS ASP Server Supporting VBScript

 WSH (Windows Script Host)

 References

 PDF Printing Version