We can use different functions of ASP ( using VBSCript ) to handle strings. Some common requirements like sending a string output to browser by using Response object or making a complex string search function there are functions to handle string. When we started our ASP scripts we stated with sending a simple string output to the browser.
There are different functions used in handling strings like finding out the length of the string to manipulating string and splitting string to create an array etc. We will discuss these string functions with examples so we can use them as reference for developing our applications.
Each tutorial here is focused on how to use one string function so you can read and understand there uses. The examples given here may not exactly match your requirements but these are developed keeping in mind give a basic understanding of the string functions and how they work. You can use the forum if you are facing any problem or a complex requirement you want to develop.
Adding strings
How to add two strings together to produce a third string? We can just display two strings by joining them using + ( plus ) symbol or using one & (ampersand ). These way two substrings can be added to crate one bigger string.
String length
We can use len function to get the length of the string. This functions counts the chars and spaces used inside the string and returns a number. We can also find out the size of the function by using lenB function.
Removing blank space
We can remove blank space present in a string at the starting or at the ending by using trim function. We can also specify ltrim or rtim to remove blank space from starting or ending of a string.
Matching string inside another string
We can use InStr function to match a string inside another string. We can specify how the matching or compare type is to be done.
Search and replace matching string
We can search and then replace matching sting by using replace function in ASP. We can also specify the matching types based on which the matching will be carried out.