String and array

Results 1 to 2 of 2

Thread: String and array

  1. #1
    Join Date
    Dec 1969

    Default String and array

    For some reason, I can&#039;t figure out how to do this. What I want to do is take a string and convert it to an array, with each element of the array equal to one letter.<BR><BR>For example:<BR>If the variable &#039;sWord&#039; was equal to "Hello", then I would want my array to be:<BR>sArray(0) = "H"<BR>sArray(1) = "e"<BR>sArray(2) = "l"<BR>sArray(3) = "l"<BR>sArray(4) = "o"<BR><BR>My mind is a little slow today. I tried using the Split function with a delimiter of an empty string, but that returns the whole word in the first element of the array.<BR><BR>Any suggestions?

  2. #2
    Join Date
    Dec 1969

    Default RE: String and array

    Dim aWord<BR>ReDim aWord(Len(sWord) - 1)<BR>For x = 1 To Len(sWord)<BR> aWord(x - 1) = Mid(sWord, x, 1)<BR>Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts