• 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: text manipulation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: text manipulation


  • Subject: Re: text manipulation
  • From: Arthur J Knapp <email@hidden>
  • Date: Tue, 05 Jun 2001 19:33:11 -0400

> Date: Tue, 05 Jun 2001 12:47:08 EDT
> From: email@hidden
> Subject: text manipulation

> I have a time string as follows "10:56 am". I have been trying to figure out a
> way to change "am" to "a.m." or to "a.m", with no luck : ). Anybody have a
> clue? Thanks.

set s to "10:56 am"

(text 1 thru 6 of s) & "a.m."
-- > "10:56 a.m."

(text 1 thru ((offset of "am" in s) - 1) of s) & "a.m."
-- > "10:56 a.m."

(text from word 1 to word -2 of s) & " a.m."
-- > "10:56 a.m."

set text item delimiters of AppleScript to {"am"}
set s to text items of s
set text item delimiters of AppleScript to {"a.m."}
set s to s as string
set text item delimiters of AppleScript to {""}
s
-- > "10:56 a.m."



Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden

Hey, check out:
<http://developer.apple.com/techpubs/macos8/InterproCom/AppleScriptScripters
/AppleScriptLangGuide/>


  • Follow-Ups:
    • Re: text manipulation
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Location Manager in OS X?
  • Next by Date: Re: newbie text manipulation
  • Previous by thread: Re: text manipulation
  • Next by thread: Re: text manipulation
  • Index(es):
    • Date
    • Thread