Re: text manipulation
Re: text manipulation
- Subject: Re: text manipulation
- From: "Marc K. Myers" <email@hidden>
- Date: Tue, 05 Jun 2001 15:09:25 -0400
- Organization: [very little]
>
Date: Tue, 05 Jun 2001 12:47:08 EDT
>
From: email@hidden
>
Subject: text manipulation
>
To: <email@hidden>
>
>
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.
>
>
John
Try this:
set theTime to "10:56 am"
set {od, AppleScript's text item delimiters} to {AppleScript's text item
delimiters, {" "}}
set timeList to text items of theTime
set AppleScript's text item delimiters to od
try
if (contents of item 2 of timeList) is "am" then
set item 2 of timeList to " a.m."
else
set item 2 of timeList to " p.m."
end if
end try
set theTime to (timeList as text)
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[6/5/01 3:09:02 PM]