How to remove or replace text from within AppleScript text
set thetextwithending to "thistext.end" as text
if thetextwithending ends with ".end" then
setthetextwithoutending to (thetextwithending - ".end" from the ending)
end if
I expect that it's something like this (although I know my syntax is wrong, I think my logic is correct):
set thetextwithoutending to "Nope. Didn't work." as text
if thetextwithending ends with ".end" then
theCount to (the number of characters in thetextwithending) as number
set theFixedCount to (theCount - 4) as number
set thetextwithoutending to (theFixedCount characters of thetextwithending) as text
end if
thetextwithoutending
PowerBook G4 1.67 Ghz, Mac OS X (10.5.5)