Tour : VBScript – Array Functions
Step 1. What is an Array?
Step 2. What is Array Functions and VB Script Provided Array functions.
Step 3. How to Declare array in VBS?
Step 4. How to Assigning Values to an Array?
Step 5. LBound Function
Step 6. UBound Function
Step 7. Filter Function
Step 8. Split Function
Step 9. IsArray Function
Step 10. Join Function
Step 11. Erase Function
Step 12. Visit GoLearningBus.Com for more ” training
1. What is an Array?
Sometimes we want to hold more than one value in a single variable at a time. When a series of values are stored in a single variable, then it is known as array variable.
2. What is Array Functions and VB Script Provided Array functions.
VBScript provide us some buitin array functions. This functions help us to manage and handle the arrays effectively.
Here we shows the builtin VBScript Array functions.
We will discuss all those function in detail in next steps.
3. How to Declare array in VBS?
An array declaration is very similar to a variable declaration. First a type is given for the elements of the array, then an identifier for the array and, within square brackets, the number of elements in the array. The number of elements must be an integer.
Here we show the declaration of array in three way.
1) Without size array declaration,
2) array declaration with their size,
3) Using ‘Array’ Parameter or builtin array function.
4. How to Assigning Values to an Array?
The values are assigned to the array by specifying array index value against each one of the values to be assigned. It can be a string.
In this example we show how to assign the value to one dimensional array and similarly you can assign value to multi dimensional array.
5. LBound Function
The LBound function returns the smallest subscript for the indicated dimension of an array.
The LBound for any dimension is ALWAYS 0.
Syntax : LBound(arrayname)
6. UBound Function
The UBound function returns the largest subscript for the indicated dimension of an array.
Syntax : UBound(arrayname)
7. Filter Function
The Filter function returns a zero-based array that contains a subset of a string array based on a filter criteria.
If no matches of the value parameter are found, the Filter function will return an empty array.
If the parameter inputstrings is Null or is NOT a one-dimensional array, an error will occur.
Syntax : Filter(inputstrings, value)
Please read the comments for more detail about syntax.
8. Split Function
The Split function returns a zero-based, one-dimensional array that contains a specified number of substrings.
Syntax : Split(expression)For more info about Syntax please read the comment that is shown here.
9. IsArray Function
The IsArray function returns a Boolean value that indicates whether a specified variable is an array. If the variable is an array, it returns True, otherwise, it returns False.
Syntax : IsArray(variable)
10. Join Function
The Join function returns a string that consists of a number of substrings in an array.
Syntax : Join(list)
11. Erase Function
The Erase Function is used to reset the values of fixed size arrays and free the memory of the dynamic arrays. It behaves depending upon the type of the arrays.
Syntax : Erase ArrayName
1) Fixed numeric array, each element in an array is resetted to Zero.
2) Fixed String array, each element in an array is resetted to Zero length.
3) Array of Objects, each element in an array is resetted to special value Nothing.
12. Visit GoLearningBus.Com for more ” training
Visit GoLearningBus.Com for more ” guided tours and training.
For only you can access more than 300 apps for a lifetime of learning and training.