Re: What is up with the 'FIND' function?
- Posted by "Patrick Barnes" <mrtrick at gmail.com> Mar 23, 2006
- 556 views
You are confusing find() and match()... find() searches a sequence looking for an element... constant haystack1 = { {1}, {2}, {3}, {4}, {5}, {6} } constant haystack2 = { 1, 2, 3, 4, 5, 6 } constant needle1 = {3} constant needle2 = 3 ? find( needle1, haystack1 ) --finds {3} within haystack1, prints 3 ? match( needle2, haystack2 ) --finds a slice of haystack2 matching needle2, prints 3 all other combinations will return 0. On 3/23/06, ZNorQ <guest at rapideuphoria.com> wrote: > > > posted by: ZNorQ <znorq at holhaug.com> > > Hey, > > I'm trying to get the 'FIND' function to use properly, but I just don't > get it to work the way I want it to. > > I have a string called zALPHA, containing all the letters in both upper > and lower case; > > constant zALPHA = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ= " > > Further, I have a sequence - 'eRevision' - which contains a letter in the > above range (Hence, the eRevision is of length 1, but still a sequence.). > > Lets say the eRevision sequence contains 'c', I'd think that the followin= g > function should return '3', but it returns '0' (Zero); > > eFindResult = find(eRevision, zALPHA) > > ..while THIS function returns the correct number; > > EFindResult = find(eRevision[1], zALPHA) > > Could someone please explain this to me? > > Regards, Kenneth 'ZNorQ' Nilsson > > > > -- MrTrick ----------