lineoffset - In Reverse

DunbarX at aol.com DunbarX at aol.com
Tue Nov 17 10:28:20 EST 2009


Are there many cases of these sections within the file? I think you could 
work the lineOffset function with the "lines to skip" offering, and work a 
routine out of it.

But here is a find function that lists all the lineNumbers of a 
searchstring. You can then process successive instances any way you need.

You would call: get revFullFind(textToSearch,textToFind,"lineNum","true")

function revFullFind tText,tFind,form,exactly
    switch
       case exactly = "true" and form = "lineNum"
          repeat for each line tline in tText
             add 1 to counter
             if tFind = tline then
                put counter & return after temp22
             end if
          end repeat
          break
       case exactly = "true" and form = "txt"
          repeat for each line tline in tText
             add 1 to counter
             if tFind = tline then
                put theLine & return after temp22
             end if
          end repeat
          break
       case exactly = "false" and form = "lineNum"
          repeat for each line tline in tText
             add 1 to counter
             if tFind is in tline then
                put counter & return after temp22
             end if
          end repeat
          break
       case   exactly = "false" and form = "txt"
          repeat for each line tline in tText
             add 1 to counter
             if tFind is in tline then
                put theLine & return after temp22
             end if
          end repeat
          break
    end switch
    return temp22
end revFullFind

Hope this helps

Craig Newman

In a message dated 11/17/09 9:38:17 AM, len-morgan at crcom.net writes:


> 1) find the line offset to the next end-of-section marker
> 2) find the line offset from #1 BACKWARDS to the first line that starts
> with "------------..."

> 
> Is there such a function?  I can always roll my own and just read lines
> backwards from #1 above until I find the start mark but why reinvent the
> wheel if such a function is already in revTalk.
> 
> 




More information about the use-livecode mailing list