That does make string searching less attractive, neh?  I'd never thought
of that - thanks for the info!

> -----Original Message-----
> From: Atrix Wolfe [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, December 03, 2002 4:53 PM
> To: Multiple recipients of list witango-talk
> Subject: Re: Witango-Talk: RE: Array to String
> 
> 
> if you are searching for a value in an array...converting to 
> a string and then searching for that string may have a few 
> properties you might not want...
> 
> first of all, converting the array to a string does take some 
> extra time to process.
> 
> Secondly there is a difference in how a computer checks for 
> something in an array as opposed to how it checks for 
> something in a string.  Hashing algorithms (etc) aside...if a 
> computer checks for a word in an array...it goes to each 
> point in the array and says "is this it?" and depending on 
> yes or no it goes onto the next element in the array...
> 
> if you have the array:
> apples
> bananas
> oranges
> 
> and search for oranges, it does 3 string tests...tests 
> apples, tests bananas, tests oranges.
> 
> if you make this into a string and get:
> applesbananasoranges and search for oranges, it starts at the 
> first a and tests if starting there, it contains the word 
> "oranges" it doesnt so it moves down a letter to the p, then 
> the next p, then the l, then the e and so on until it gets to 
> the o and returns success...this in effect is 13 string 
> compares...compare 3 to 13 and remember this is only a 3 
> element array, imagine if it were 50!  Even if it seems more 
> cumbersome to test row by row, it is in fact more efficient.
> 
> Lasty theres a problem of false positives, they are unlikely 
> but very possible.
> 
> if you have the array:
> oranges
> apples
> bananas
> sap
> 
> and make it into the string:
> orangesapplesbananassap
> 
> and search for "sap" you will notice in the string there are 
> 2 occurences (end of oranges running into the begining of 
> apples) while in the array there is only 1.  Gotta be careful 
> with that one, but it can be solved by seperating the words 
> with spaces when you make the array by changing csuffix to ' 
> ' (space).
> 
> 
> hope this helps some (:
> 
> ----- Original Message -----
> From: "David Shelley" <[EMAIL PROTECTED]>
> To: "Multiple recipients of list witango-talk" 
> <[EMAIL PROTECTED]>
> Sent: Tuesday, December 03, 2002 2:29 PM
> Subject: RE: Witango-Talk: RE: Array to String
> 
> 
> > To convert an array to a string you can use the <@var> tag. <@var 
> > yourArray aprefix='' asuffix='' rprefix='' rsuffix='' cprefix='' 
> > csuffix=''> This will append all the values together in one string.
> >
> > To check if a value is in the array use
> > <@if expr="@@yourArray contains @@yourString">
> > The contains operator acting on an array does an = on each 
> element in 
> > the array, so if any element in the array matches your 
> string exactly 
> > then the expression is true.
> >
> > Dave Shelley
> > [EMAIL PROTECTED]
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Wilcox, Jamileh
> > Sent: Tuesday, December 03, 2002 4:44 PM
> > To: Multiple recipients of list witango-talk
> > Subject: Witango-Talk: RE: Array to String
> >
> >
> > Or, alternatively, is there a way to see if something is in 
> an array, 
> > without having to loop through the rows?
> >
> > >  -----Original Message-----
> > > From: Wilcox, Jamileh
> > > Sent: Tuesday, December 03, 2002 3:41 PM
> > > To: 'Witango-Talk'
> > > Subject: Array to String
> > >
> > > Is there anything in Witango that acts like the Javascript JOIN 
> > > method (i.e., just converts an array to a delimited string)?  It 
> > > sure would make life easier sometimes.
> > >
> > > Thanks.     j
> > 
> ______________________________________________________________________
> > __
> > TO UNSUBSCRIBE: send a plain text/US ASCII email to 
> [EMAIL PROTECTED]
> >                 with unsubscribe witango-talk in the message body
> >
> > 
> ______________________________________________________________________
> > __
> > TO UNSUBSCRIBE: send a plain text/US ASCII email to 
> [EMAIL PROTECTED]
> >                 with unsubscribe witango-talk in the message body
> 
> ______________________________________________________________
> __________
> TO UNSUBSCRIBE: send a plain text/US ASCII email to 
> [EMAIL PROTECTED]
>                 with unsubscribe witango-talk in the message body
> 
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
                with unsubscribe witango-talk in the message body

Reply via email to