Easy way to get the "white space" before the first word of a line?

Mark Schonewille m.schonewille at economy-x-talk.com
Tue Mar 25 17:14:30 EDT 2008


Hi Dave,

Assuming that the whitespace always starts on char 1 of the line, this  
should work:

function whiteSpace theText
   return char 1 to (offset(word 1 of theText,theText) - 1) of theText
end whiteSpace

function whiteChunk theText
   return "char 1 to" && (offset(word 1 of theText,theText) - 1)
end whiteChunk

Best,

Mark

Best regards,

Mark Schonewille

--

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

A large collection of scripts for HyperCard, Revolution, SuperCard and  
other programming languages can be found at http://runrev.info




On 25 mrt 2008, at 22:08, David Bovill wrote:
> I want to get hold of the "white space" - ie tabs or space -  before  
> the
> first word of a line. I can do it of course with repeat loops - but  
> is there
> a way using Revs built in chunks?
>
> Something like:
>
>    put word 0 to 1 of "      first second"




More information about the use-livecode mailing list