Left Function
Tips >>ASP Functions

WANTS TO MAKE SOFTWARE WITHOUT KNOWLEDGE OF ASP? CLICK HERE


The Left function returns a specified number of characters from the left side of a string. The Function will return the number of characters you specify. As is obvious it starts from the left. Left is a commonly used ASP function that allows you to copy characters from the left side of a string. The Left function returns the left portion of the designated string for a designated length.

There are Two Mandatory Arguments :-
  • The string variable to operate on
  • An integer representing how many characters to copy

The Syntax of the Left function is :-

Left(string,length)

Example#1 :-

Code :-
dim txt
txt="This is a beautiful day!"
document.write(Left(txt,11))
Output :-
This is a b

Example#2 :-

Code :-
dim txt
txt="This is a beautiful day!"
document.write(Left(txt,100))
Output :-
This is a beautiful day!

Example#3 :-

Code :-
dim txt,x
txt="This is a beautiful day!"
x=Len(txt)
document.write(Left(txt,x))
Output :-
This is a beautiful day!

Example#4 :-

Code :-
<%
String1="Michael"
response.write "The first 3 letters of my name are " & Left(String1,3)
%>
Output :-
The first 3 letters of my name are Mic

Note :- The LeftB function is used with byte data contained in a string. Instead of specifying the number of characters to return, length specifies the number of bytes.

 

 
E-mail : sales@virtualsplat.com
Phone : +91-9892413501

Whatsapp Icon +91-9967648641

Whatsapp Icon +91-9967648641