-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Praveen Nandagiri
committed
Jun 16, 2021
1 parent
eb4a55c
commit 8147fa8
Showing
9 changed files
with
176 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Class ArrayUtil | ||
|
||
Public Function toString(arr) | ||
If Not isArray(arr) Then | ||
toString = "Supplied parameter is not an array." | ||
Exit Function | ||
End If | ||
|
||
Dim s, i | ||
s = "Array{" & UBound(arr) & "} [" & vbCrLf | ||
For i = 0 to UBound(arr) | ||
s = s & vbTab & "[" & i & "] => [" & arr(i) & "]" | ||
if i < UBound(arr) Then s = s & ", " | ||
s = s & vbCrLf | ||
Next | ||
s = s & "]" | ||
toString = s | ||
|
||
End Function | ||
|
||
Public Function contains(arr, s) | ||
If Not isArray(arr) Then | ||
toString = "Supplied parameter is not an array." | ||
Exit Function | ||
End If | ||
|
||
Dim i, bFlag | ||
bFlag = false | ||
For i = 0 to UBound(arr) | ||
If arr(i) = s Then | ||
bFlag = true | ||
Exit For | ||
End If | ||
Next | ||
contains = bFlag | ||
End Function | ||
|
||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cscript //nologo .\test.wsf //job:Test1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<package> | ||
<job id="Test0"> | ||
<script language="VBscript" src="ArrayUtil.vbs" /> | ||
<script language="VBScript"> | ||
arr = Array("item1", "2", "I'm 3") | ||
set au = new ArrayUtil | ||
Wscript.Echo au.toString(arr) | ||
</script> | ||
</job> | ||
<job id="Test1"> | ||
<script language="VBscript" src="ArrayUtil.vbs" /> | ||
<script language="VBScript"> | ||
arr = Array("item1", "item2", "item3") | ||
set au = new ArrayUtil | ||
Wscript.Echo "item1 contains: " & au.contains(arr, "item1") | ||
Wscript.Echo "[ item1] contains: " & au.contains(arr, " item1") | ||
Wscript.Echo "[item1 ] contains: " & au.contains(arr, "item1 ") | ||
Wscript.Echo "Item1 contains: " & au.contains(arr, "Item1") | ||
Wscript.Echo "item2 contains: " & au.contains(arr, "item2") | ||
Wscript.Echo "item3 contains: " & au.contains(arr, "item3") | ||
Wscript.Echo "item4 contains: " & au.contains(arr, "item4") | ||
</script> | ||
</job> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters