Numbering of lines in a field

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Apr 28 02:11:26 CEST 2014


Hi Charles,

I think the script you need looks like the following:

constant dot = "."
function lineNumbering theLines
   put 0 into myCounter
   repeat for each line myLine in theLines
     if "CHC" is word 1 of myLine then
       put 0 into myCounter
       put myLine & cr after myNewLines
     else
       add 1 to myCounter
       put myCounter & dot && myLine after myNewLines
     end if
   end repeat
   return char 1 to -2 of myNewLines
end lineNumbering

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 4/28/2014 02:00, Charles Szasz wrote:
> I have a scrolling field that contains a number of lines. Some of the lines begin with “CHC".  I have been trying to number only the lines between lines that contain “CHC”  and then starts numbering again between the next pair of lines containing “CHC”
>
> For example,
>
> CHC
> 1.
> 2.
> 3.
> 4.
> 5.
> CHC
> 1.
> 2.
> 3.
> CHC
> 1.
> 2.
> 3.
> 4.
> 5.
>
> I have tried different variations with the following script and achieved numbering sequentially between CHC lines but the numbering does not start over after each line CHC line.
>
> repeat with i = 1 to the number of lines in field “recommendations"
>           if "CHC" is not among the words of line i in field "recommendations"
>           then
>              put i &"."& space before line i of field "recommendations"
>           end if
> end repeat
>
> Any suggestions?
>
> Charles Szasz
> cszasz at mac.com
>
>




More information about the use-livecode mailing list