+ Reply to Thread
Results 1 to 3 of 3

removing blank entries from an array

  1. #1
    Registered User
    Join Date
    12-15-2005
    Posts
    23

    removing blank entries from an array

    i have an array of strings. i'm trying to make a function that will return the arry without blank entries.

    input would be: "text"/"words"/""/"more words"/""
    result woud be: "text"/"words"/"more words"

  2. #2
    Tom Ogilvy
    Guest

    Re: removing blank entries from an array

    j = lbound(ar) - 1
    for i = lbound(ar) to ubound(ar)
    if ar(i) <> "" then
    j = j + 1
    ar(j) = ar(i)
    end if
    Next
    Redim Preserve ar(lbound(ar) to j)

    --
    Regards,
    Tom Ogilvy


    "TheIrishThug" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > i have an array of strings. i'm trying to make a function that will
    > return the arry without blank entries.
    >
    > input would be: "text"/"words"/""/"more words"/""
    > result woud be: "text"/"words"/"more words"
    >
    >
    > --
    > TheIrishThug
    > ------------------------------------------------------------------------
    > TheIrishThug's Profile:

    http://www.excelforum.com/member.php...o&userid=29682
    > View this thread: http://www.excelforum.com/showthread...hreadid=494693
    >




  3. #3
    Registered User
    Join Date
    12-15-2005
    Posts
    23
    thanks Tom

    Quote Originally Posted by Tom Ogilvy
    j = lbound(ar) - 1
    for i = lbound(ar) to ubound(ar)
    if ar(i) <> "" then
    j = j + 1
    ar(j) = ar(i)
    end if
    Next
    Redim Preserve ar(lbound(ar) to j)

    --
    Regards,
    Tom Ogilvy


    "TheIrishThug" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > i have an array of strings. i'm trying to make a function that will
    > return the arry without blank entries.
    >
    > input would be: "text"/"words"/""/"more words"/""
    > result woud be: "text"/"words"/"more words"
    >
    >
    > --
    > TheIrishThug
    > ------------------------------------------------------------------------
    > TheIrishThug's Profile:

    http://www.excelforum.com/member.php...o&userid=29682
    > View this thread: http://www.excelforum.com/showthread...hreadid=494693
    >

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1