
- VBScript Tutorial
- VBScript - Home
- VBScript - Overview
- VBScript - Syntax
- VBScript - Enabling
- VBScript - Placement
- VBScript - Variables
- VBScript - Constants
- VBScript - Operators
- VBScript - Decisions
- VBScript - Loops
- VBScript - Events
- VBScript - Cookies
- VBScript - Numbers
- VBScript - Strings
- VBScript - Arrays
- VBScript - Date
- VBScript Advanced
- VBScript - Procedures
- VBScript - Dialog Boxes
- VBScript - Object Oriented
- VBScript - Reg Expressions
- VBScript - Error Handling
- VBScript - Misc Statements
- VBScript Useful Resources
- VBScript - Questions and Answers
- VBScript - Quick Guide
- VBScript - Useful Resources
- VBScript - Discussion
VBScript Mid Function
Mid
The Mid Function returns a specified number of characters from a given input string.
Syntax
Mid(String,start[,Length])
String, a Required Parameter. Input String from which the specified number of characters to be returned.
Start, a Required Parameter. An Integer, which Specifies starting position of the string.
Length, an Optional Parameter. An Integer, which specifies the number of characters to be returned.
Example
<!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> var = "Microsoft VBScript" document.write("Line 1 : " & Mid(var,2) & "<br />") document.write("Line 2 : " & Mid(var,2,5) & "<br />") document.write("Line 3 : " & Mid(var,5,7) & "<br />") </script> </body> </html>
When you save it as .html and execute it in Internet Explorer, then the above script will produce the following result −
Line 1 : icrosoft VBScript Line 2 : icros Line 3 : osoft V
vbscript_strings.htm
Advertisements