How can I create a array of string with words of a text?

Posted on 2011-05-12
Last Modified: 2012-05-11
Hello guys

I have a text in a string variable this way:

str = create house table nice

with this variable I need to create an array of string this way:

v(0) = "create"
v(1) = "house"
v(2) = "table"
v(3) = "nice"

how to do this?

Question by:hidrau
    LVL 32

    Expert Comment

    by:Big Monty
    use the split function:

    arrStr = Split( str, " " )
    LVL 1

    Author Comment

    ok, and How can I count how many string is inside of it? is there any way?
    LVL 32

    Accepted Solution

    sure, you would use the UBound function, which takes the upper bound (limit) of an array. Keep in mind it has a zero based index, so with if 4 is returned, there are really 5 elements in the array.

    str = "create house table nice"
    arrStr = Split( str, " " )
    numElements = UBound( arrStr )

    numElements would be equal to 3
    LVL 1

    Author Closing Comment


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now