
- 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 String Function
String
The String Function fills a string with the specified character the specified number of times.
Syntax
String(number,character)
Number, a Required Parameter. An integer value, which would be repeated for the specified number of times against the character parameter.
Character, a Required Parameter. Character value, which has to be repeated for the specified number of times.
Example
<!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> document.write("Line 1 :" & String(3,"$") & "<br />") document.write("Line 2 :" & String(4,"*") & "<br />") document.write("Line 3 :" & String(5,100) & "<br />") document.write("Line 4 :" & String(6,"ABCDE") & "<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 :$$$ Line 2 :**** Line 3 :ddddd Line 4 :AAAAAA
vbscript_strings.htm
Advertisements