Re: Replacing range within a string
Re: Replacing range within a string
- Subject: Re: Replacing range within a string
- From: Bryan Harris <email@hidden>
- Date: Tue, 27 Feb 2001 13:24:31 -0600
>
> Is there an equivalent of the Perl "substr" command in AS?
>
>
>
> More specifically, I'd like to remove the seconds on a "time string of
>
> (current date)". Is there an easy way to do this?
>
>
>
> (something like: set text -6 thru -4 of aTimeString to "")
>
>
this will remove the seconds from the current date
>
>
set now to characters 1 thru -4 of ((current date) as string) as text
>
>
for a more general AppleScript version of Perl's substr you might take a
>
look at "munge" in Akua Sweets
>
Thanks for the tip. The intent was to leave the AM/PM, though. I realize
you can use:
set aTime to time string of (current date)
set aTime to (text 1 thru -7 of aTime) & (text -3 thru -1 of aTime)
I was just wondering if there was a plain vanilla AS way to delete text from
the middle of a text item.
- B