Single Post

Header

Sunday, September 30, 2012

Predefined Functions in vb script

' main functions used in vb script

'array -->used for array creation
a=array(12,13,14,15)
msgbox a(2)

' cint function-->converts into interger
' inputbox function-->takes user input
a=cint(inputbox("enter number"))
msgbox a


' createobject --->used for creating objects
set obj=createobject("scripting.filesystemobject")
obj.createtextfile("d:\test5.txt")

' date and day
msgbox date
msgbox day(date)

' isarray -->returns true if if the argument is an array
b=array(12,13)
msgbox isarray(b)

' lbound & ubound
msgbox lbound(b)& " " &ubound(b)

' lcase and ucase

str="aBcD"
msgbox lcase(str)&" " &ucase(str)

' string comparison and reverse
str1="abcd"
str2="bcde"
msgbox strcomp(str1,str2)
msgbox strreverse(str1)

' len , left and right functions
msgbox len("welcome to vb script")
msgbox left("i am venkatesh",11)
msgbox right("my native place is jmpuram",7)

' trim and replace functions

msgbox " welcome to vb script "
msgbox trim(" welcome to vb script ")

msgbox replace(" welcome to java script ","java","vb")

' join and split functions


dim str3(2)
str3(0)="hai"
str3(1)="bye"
msgbox join(str3,"join") 'o/p " haijoinbyejoin

str="we are the youth of the nation"
arr=split(str)
for each i in arr
msgbox i
next


msgbox "Completed Successfully"

No comments:

Post a Comment