• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Replacing range within a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Replacing range within a string (From: g3pb <email@hidden>)

  • Prev by Date: Re: Duplicate and rename folder path
  • Next by Date: Re: global variable not being recognized by script object subroutine
  • Previous by thread: Re: Replacing range within a string
  • Next by thread: Re: Replacing range within a string
  • Index(es):
    • Date
    • Thread