VBScript Tutorials - Herong's Tutorial Examples - Version 5.20, by Dr. Herong Yang

Built-in String Functions

This section provides a list of commonly used built-in string functions.

VBScript supports the following commonly used string functions:

  • InStr(sString, sSubString) - Returns the position of the first occurrence of one string within another. The search begins at the first character of the string
  • InStrRev(sString, sSubString) - Returns the position of the first occurrence of one string within another. The search begins at the last character of the string
  • LCase(sString) - Converts a specified string to lowercase
  • Left(sString, iLen) - Returns a specified number of characters from the left side of a string
  • Len(sString) - Returns the number of characters in a string
  • LTrim(sString) - Removes spaces on the left side of a string
  • RTrim(sString) - Removes spaces on the right side of a string
  • Trim(sString) - Removes spaces on both the left and the right side of a string
  • Mid(sString, iStart, iLen) - Returns a specified number of characters from a string
  • Replace(sString, sOld, sNew) - Replaces a specified part of a string with another string a specified number of times
  • Right(sString, iLen) - Returns a specified number of characters from the right side of a string
  • Space(iLen) - Returns a string that consists of a specified number of spaces
  • StrComp(sString1, sString2) - Compares two strings and returns a value that represents the result of the comparison
  • String(iLen, sChar, iLen) - Returns a string that contains a repeating character of a specified length
  • StrReverse(sString) - Reverses a string
  • UCase(sString) - Converts a specified string to uppercase
  • Asc(sString) - Converts the first letter in a string to ANSI code
  • Chr(iInteger) - Converts the specified ANSI code to a character

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

 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

 Built-in Math Functions

 Built-in Conversion Functions

Built-in String Functions

 Built-in Date and Time Functions

 Built-in Array Functions

 Built-in Misc. 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

 Printable Copy - PDF Version

Built-in String Functions - Updated in 2015, by Dr. Herong Yang