Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
15
Task/Flatten-a-list/VBScript/flatten-a-list-4.vb
Normal file
15
Task/Flatten-a-list/VBScript/flatten-a-list-4.vb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
' Flatten the example array...
|
||||
a = FlattenArray(Array(Array(1), 2, Array(Array(3,4), 5), Array(Array(Array())), Array(Array(Array(6))), 7, 8, Array()))
|
||||
|
||||
' Print the list, comma-separated...
|
||||
WScript.Echo Join(a, ",")
|
||||
|
||||
Function FlattenArray(a)
|
||||
If IsArray(a) Then DoFlatten a, FlattenArray: FlattenArray = Split(Trim(FlattenArray))
|
||||
End Function
|
||||
|
||||
Sub DoFlatten(a, s)
|
||||
For i = 0 To UBound(a)
|
||||
If IsArray(a(i)) Then DoFlatten a(i), s Else s = s & a(i) & " "
|
||||
Next
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue