Concatenating Strings in ASP/VBScript

In ASP you concatenate strings with the use of the ampersand (&) placed between the strings that you wish to join. For example think of a scenario where you had the firstname and lastname of a customer stored in separate variables and you wished to join and display them as one string.

The example below creates two variables sFirstName and sLastName and assigns them values. We then write them to the browser combining all the strings using ampersands. Notice the space character between the variables sFirstName and sLastName, this is just used for formatting purposes.

Example 1:

'Declare variables
Dim sFirstName, sLastName
sFirstName ="John"
Response.write "Customer name is " & sFirstName & " " & sLastName

The result:
Customer name is John Doe

Get the best ASP hosting with DiscountASP.NET - great value, money back guarantee.



MembersPro PayPal - ASP Membership software

Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.

Global ASP.NET Hosting Leader - Click Here