Re: stripping an extra character from a text item
Re: stripping an extra character from a text item
- Subject: Re: stripping an extra character from a text item
- From: email@hidden
- Date: Tue, 18 Dec 2001 17:02:37 -0600
At 17:09 -0500 12/18/2001, Mark Martin wrought:
>
Try this for stripping unwanted characters:
>
>
on Trim(cString)
>
set WhiteChars to " "
>
set Trimmed to false
>
repeat until trimmed
>
if character -1 of cString is contained in WhiteChars then
>
...
______________________________________________________________________
Not bad 't all, but I still prefer regular expressions.
RegEx Commands Osax:
http://www.lazerware.com/FTP/RECommands.hqx
----------------------------------------------------------------------
on rTrim(theString, trimString)
set trimString to "[" & trimString & "]+$"
return REReplace theString pattern trimString with ""
end rTrim
on lTrim(theString, trimString)
set trimString to "^[" & trimString & "]+"
return REReplace theString pattern trimString with ""
end lTrim
set t to " Now is the time! "
set trimedString to rTrim(lTrim(t, " "), " ")
----------------------------------------------------------------------
At 14:22 -0800 12/18/2001, Mark Butcher wrote:
>
set extraSpace to "87.54 "
>
(word 1 of extraSpace) as real
This actually does work for me with AppleScript 1.6, but I'm not positive that I don't have an osax coercion working in the mix.
Best Regards,
Christopher Stone
______________________________
StoneWorks Computer Consulting
email@hidden