Probably a silly question about 'find'

Jim Ault JimAultWins at yahoo.com
Thu Jan 18 14:24:28 EST 2007


There are several strategies you could use.

--if you only want to grab the data
put 4 into tagg
get fld numberedList
filter it with tagg&tab&"*"

--now the only lines that remain in it are those that start with tagg&tab
--filter only looks at lines
---
If you need to know which line number this match resides on then use the
naturally occuring cr instead of a "#" sign

put 4 into tagg
put lineOffset(cr&tagg&tab, cr&fld numberedList) + 1 into hitLine
--this only reports the first match
--the line number will match the fld listing

This should get you where you want to go without RegEx or matchChunk or set
the wholematches to true (the decimal is the problem here)

Let me know if you need a more rigorous solution.

Jim Ault
Las Vegas

On 1/18/07 1:32 AM, "Peter Alcibiades" <palcibiades-first at yahoo.co.uk>
wrote:

> Feels like a very silly question, but it is stumping me.
> 
> How do I use 'find' to find '4' when it occurs by itself but not 4 when it
> occurs in '4.1', when searching the contents of a field?
> 
> I have a field with tab separated values in the form
> 
> 1 1234
> 2 2.56
> 3 4.1
> 4 9.274
> 
> and I want to find only that line in which there is a match of the inputted
> string with the first item.  The first item will always be a unique value.
> So I want in some way to do a find on 4 that will pick up only line 4, and
> not the occurrence of 4 in line 3.
> 
> Find word doesn't seem to work, because presumably Rev sees the '.' as a word
> limiter.  Whereas in fact, its a decimal....  Find string in item 1 doesn't
> work either.   In fact, none of the parameters on find seem to work.
> 
> The only thing that has occurred to me is a real kludge - just stick some
> character like # in front of or after the numbers in the first position, and
> then search for #4, and hope that it never occurs to anyone to put this
> character into the second field!  But there must surely be a very simple and
> much better way?
> 
> Peter
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list