English Translation of Script Examples vbscript autoit php batch
Sprache ändernEnglish (United Kingdom) German (DE)

vbscript Array Functions - Syntax Reference

(4)
rate this article
(63)

working with Arrays in vbscript

Array
used to set values into an Array
Example:
arrayvalues=Array(10,29,23,99)
wscript.echo arrayvalues(2)

Output: 23 (beginning with 0 means the 3rd value in the Array)

Filter
Syntax:Filter(inputarray, value)
Example:
arrayvalues=Array("abbb","accc","ccdd","deef")
compare=filter(arrayvalues,"c")
wscript.echo compare(0)
wscript.echo compare(1)

Output:
accc
ccdd
(returns entries found in the Array)

isArray
Example:
arrayvalues=Array("abbb","accc","ccdd","deef")
wscript.echo isarray(arrayvalues)

Output:
-1 (means "arrayvalues" is an array, if it returns 0 "arrayvalues" isn't an array)

join
used to write an Array into an Variable
Example:
arrayvalues=Array("abbb","accc","ccdd","deef")
wscript.echo join(arrayvalues)

Output:
abbb accc ccdd deef

LBound
returns the smallest Array Value
Example:
arrayvalues=Array("abbb","accc","ccdd","deef")
wscript.echo LBound(arrayvalues)

Output:
0 (because "abbb" is the first Array entry witch has the Array Number 0: arrayvalues(0))

UBound
returns the highest Array Value
Example:
arrayvalues=Array("abbb","accc","ccdd","deef")
wscript.echo UBound(arrayvalues)

Output:
3 (because "deef" is the last Array entry witch has the Array Number 3: arrayvalues(3))

Split
converts an Variable into an Array
Example:
text="hier%der%Text"
splittext=Split(text, "%")
wscript.echo splittext(0)
wscript.echo splittext(1)
wscript.echo splittext(2)

Output:
hier
der
Text
(the Split function splits the text at defined delimiters in this example "%")
<<< vbscript Date Time Functions - Syntax Reference vbscript string Functions - Syntax Reference >>>


new article

Search on this page
22.10.2019 21:43 now 1 Reader online