Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2011-05-12
4
Medium Priority
?
203 Views
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?

thanks
alex
0
Comment
Question by:hidrau
  • 2
  • 2
4 Comments
 
LVL 34

Expert Comment

by:Big Monty
ID: 35749582
use the split function:

arrStr = Split( str, " " )
0
 
LVL 1

Author Comment

by:hidrau
ID: 35749675
ok, and How can I count how many string is inside of it? is there any way?
0
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 35749711
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
0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 35749728
thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month15 days, 20 hours left to enroll

581 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