VBScript String Functions
1.LCase
2.UCase
3.Left
4.Right
5.Len
6.Mid
LCase Function:Converts a specified string to lowercase.
Syntax:LCase(string)
Ex1:a=LCase("LAKSHMI")
Msgbox a
Output=lakshmi
UCase Function:Converts a specified string to uppercase.
Syntax:UCase(string)
Ex:a=UCase("laxmi")
Msgbox a
Output=LAXMI
Left Function:Returns a specified number of characters from the left side of a string.
Syntax:Left(string,length)
Ex:a=Left("Lakshmi",3)
Msgbox a
Output=Lak
Right Function:Returns a specified number of characters from the right side of a string.
Syntax:Right(string,length)
Ex:a=Right("Lakshmi",3)
Msgbox a
Output=hmi
Len Function:Returns the number of characters in a string.
Syntax:Len(string)
Ex:a=Len("Lakshmi")
Msgbox a
Output=7
Mid Function:Returns a specified number of characters from a string.
Syntax:Mid(string, start[, length])where length is optional.
Ex1:a=Mid("Lakshmi",1)
Msgbox a
Output=Lakshmi
Here starting position of string is 1 and as their is no number specified for length(optional)output is whole string i.e Lakshmi.
Ex2:a=Mid("Lakshmi",4)
Msgbox a
Output=shmi
Starting position is 4 and no length specified result(output)string starts from 4th position of given string to till end of the string i.e shmi
Ex3:a=Mid("Lakshmi",4,3)
Msgbox a
Output=shm
Starting position is 4 and length is 3 result(output)string starts from 4th position of given string and it takes next 2 characters in the string(including 4th position character total becomes 3 characters)and returns the result as shm.
VBScript String Functions(2)
VBScript String Functions(1)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment