• 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: Reformatting a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reformatting a string


  • Subject: Re: Reformatting a string
  • From: Michelle Steiner <email@hidden>
  • Date: Fri, 27 Jan 2012 12:48:25 -0700

On Jan 27, 2012, at 11:07 AM, Angelo wrote:

I need to take a long string string of letters numbers and colons and convert it to uppercase letters w/ no colons.    
a2:fh:2f:vv:i1:q1   needs to be  A2FH2FVVI1Q1. 

set x to "a2:fh:2f:vv:i1:q1"
set text item delimiters to {":"}
set x to text items of x
set text item delimiters to {""}
set x to x as string
set y to {}
repeat with i from 1 to count of x
set z to ASCII number of character i of x
if z > 96 and z < 123 then
copy (ASCII character of (z - 32)) to end of y
else
copy character i of x to end of y
end if
end repeat
set y to y as string


--> "A2FH2FVVI1Q1"


-- Michelle


--

"If you don't preach in my school I won't think in your church"


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Reformatting a string
      • From: KOENIG Yvan <email@hidden>
References: 
 >Reformatting a string (From: Angelo <email@hidden>)

  • Prev by Date: Re: Reformatting a string
  • Next by Date: Re: Reformatting a string
  • Previous by thread: Re: Reformatting a string
  • Next by thread: Re: Reformatting a string
  • Index(es):
    • Date
    • Thread