X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

VBScript Left Function


VBScript Reference Complete VBScript Reference

The Left function returns a specified number of characters from the left side of a string.

Tip: Use the Len function to find the number of characters in a string.

Tip: Also look at the Right function.

Syntax

Left(string,length)

Parameter Description
string Required. The string to return characters from
length Required. Specifies how many characters to return. If set to 0, an empty string ("") is returned. If set to greater than or equal to the length of the string, the entire string is returned

Examples

Example 1

<%

txt="This is a beautiful day!"
response.write(Left(txt,15))

%>

The output of the code above will be:

This is a beaut

Show Example »

Example 2

Return the whole string:

<%

txt="This is a beautiful day!"
x=Len(txt)
response.write(Left(txt,x))

%>

The output of the code above will be:

This is a beautiful day!

Show Example »

VBScript Reference Complete VBScript Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook