On 8/9/05 7:36 PM, "Ken Ray" <[EMAIL PROTECTED]> wrote:
> On 8/9/05 8:17 PM, "Sivakatirswami" <[EMAIL PROTECTED]> wrote:
>
>> I'm missing something very simple here,
>>
>> Goal: delete empty lines beginning and end of text chunk
>
> Try this:
>
> function trim pWhat
> local tRetVal
> get matchText(pWhat, "(?s)^\s*(.*?)\s*$", tRetVal)
> return tRetVal
> end trim
>
>
> Trims all forms of whitespace (CRs, spaces, tabs, etc.) from the beginning
> and end of a text chunk.
Or try the following if you want only to strip all occurrences of a
character, such as "return," from the beginning and/or ending of a string:
function strip pString,pSide,pChar
if pString is not empty then
put pString into tString
if pChar is empty then put return into tChar
else put pChar into tChar
switch pSide
case ""
case "both"
put strip(tString,"left",tChar) into tString
put strip(tString,"right",tChar) into tString
break
case "left"
repeat until char 1 of tString is not tChar
delete char 1 of tString
end repeat
break
case "right"
repeat until char -1 of tString is not tChar
delete char -1 of tString
end repeat
break
end switch
return tString
end if
end strip
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution