How can I Place Each Word In an Array 
Author Message
 How can I Place Each Word In an Array

Hi Reg

s = "I want an array of words"
Alines(aa,s,.T.,Chr(32))
For each word in aa
? word
next

-Anders


Quote:
> I have a character field containing unknown amount of words, how can i get
> each word deliminated by space into an array?

> Thanks!



Fri, 10 Dec 2004 20:20:14 GMT  
 How can I Place Each Word In an Array

Quote:

> Hi Reg

> s = "I want an array of words"
> Alines(aa,s,.T.,Chr(32))
> For each word in aa
> ? word
> next

Is that your last offer?
8-)

Mark



Sat, 11 Dec 2004 16:28:17 GMT  
 How can I Place Each Word In an Array

Quote:
> I have a character field containing unknown amount of words, how can i get
> each word deliminated by space into an array?

Hello,

* if you know the maximum number of elements then you can
* optimise this somewhat by dimensioning the array at the beginning
* rather than resizing it every loop pass

* in fact, re-reading your post, you are pulling from a character field so
* presumably you cannot have more than 127 words (254 chars, space
delimited..)

* other people's solutions are more elegant but I don't know which
* version of fox you have so here is one that works in 2.6

* input data is here in (s)entence
s="here is a test"

s1=s
e=0
p=-1
DO WHILE p<>0
 e=e+1
 DIMENSION words(e)
 p=AT(' ',s1)
 IF p=0
  words(e)=s1
 ELSE
  words(e)=SUBSTR(s1,1,p-1)
  s1=LTRIM(SUBSTR(s1,p))
 ENDIF
ENDDO

disp memo like words

HTH
--
Andrew Howell



Sun, 12 Dec 2004 20:46:31 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How can I Place Each Word In an Array

2. Array of Arrays (can you do it?)

3. About to retrieve the data into an array and compare the data in the array

4. Sending words (or codes for the words) used to locate records with SELECT to a field

5. merge with word perfect or ms word

6. Word automation in Windows XP/Word 2002

7. Word automation - closing Word..

8. Using an @SAY to place data in a modify memo window

9. Using Select - SQL in place of browse

10. Where should I place the code at???

11. decimal places ?

12. Currency field diplays too many decimal places

 

 
Powered by phpBB® Forum Software