Sunday, 1 December 2019

Convert a string into an array without using Split function

Dim arr()
strText = "Hello"

intlength = len(strText)
intUbound = intlength - 1
Redim arr(intUbound)

For i = 1 to len(strText)
   arr(i-1) = mid(strText,i,1)
Next

'Display Ubound of array and its elements

MsgBox ubound(arr)
for i = lbound(arr) to ubound(arr)
   MsgBox arr(i)
Next

No comments:

Post a Comment