In this post we discusses examples working with arrays and manipulating them in vbscript:
intcount = ubound(arrayname)
dl=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
daysinWeek = join(dl, " ")
msgbox "days in weeks " & daysinWeek
dl="Sunday>Monday>Tuesday>Wednesday>Thursday>Friday>Saturday"
daysinWeek = split(dl, ">")
This method can be used on looping as shown in example below:
1.How to count number of elements in an array
intcount = ubound(arrayname)
2. How to join all the values in an array to a string and display the value in messagebox
dl=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
daysinWeek = join(dl, " ")
msgbox "days in weeks " & daysinWeek
3. How to split values in a string in an array based on delimiter
dl="Sunday>Monday>Tuesday>Wednesday>Thursday>Friday>Saturday"
daysinWeek = split(dl, ">")
This method can be used on looping as shown in example below:
No comments:
Post a Comment