• 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: Considering case...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Considering case...


  • Subject: Re: Considering case...
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 22 Feb 2014 18:30:38 -0600

On Feb 22, 2014, at 14:36, koenig.yvan <email@hidden> wrote:
Using character ID versus ASCII character isn't sufficient because we can't define a range of UPPERCASE versus a range of lowercase.

This is why I choose to rely upon a serious case converter.
______________________________________________________________________

Hey Yvan,

Did the OP mention case conversion?  I must have missed that...

I usually use the Satimage.osax for upper/lower case conversions in Applescript, but there are other options.

I imagine Shane will chime in with an ASObjC library that will do the job quite nicely as well.

--
Best Regards,
Chris

-------------------------------------------------------------------------------------------

set _string to "É UM MAÇO ; Œ Ä Â Ü Û"

# Satimage.osax { http://tinyurl.com/dc3soh }

set sioLwr to lowercase _string
--> "é um maço ; œ ä â ü û"

set sioUppr to uppercase sioLwr
--> "É UM MAÇO ; Œ Ä Â Ü Û"

set string2 to "Now is the time for all good men to come to the aid of their country."

cng("\\b(.)", "\\l\\1", _string) of me
--> "é uM mAÇO ; œ ä â ü û"

cng("\\b(\\w)", "\\u\\1", string2) of me
--> "Now Is The Time For All Good Men To Come To The Aid Of Their Country."

# Perl Handlers

set perlLwr to lower_Case(_string)
--> "é um maço ; œ ä â ü û"

set perlUppr to upper_Case(perlLwr)
--> "É UM MAÇO ; Œ Ä Â Ü Û"

-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on lower_Case(_string)
do shell script "perl -we 'use utf8; binmode STDOUT, \":utf8\"; print lc \"" & _string & "\"'"
end lower_Case
on upper_Case(_string)
do shell script "perl -we 'use utf8; binmode STDOUT, \":utf8\"; print uc \"" & _string & "\"'"
end upper_Case
-------------------------------------------------------------------------------------------
on cng(findText, changeText, srcData)
change findText into changeText in srcData with regexp without case sensitive
end cng
-------------------------------------------------------------------------------------------

 _______________________________________________
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: Considering case...
      • From: "koenig.yvan" <email@hidden>
References: 
 >Re: Considering case... (From: Steve Thompson <email@hidden>)
 >Re: Considering case... (From: "koenig.yvan" <email@hidden>)
 >Re: Considering case... (From: Christopher Stone <email@hidden>)
 >Re: Considering case... (From: "koenig.yvan" <email@hidden>)

  • Prev by Date: Re: Considering case...
  • Next by Date: Re: Considering case...
  • Previous by thread: Re: Considering case...
  • Next by thread: Re: Considering case...
  • Index(es):
    • Date
    • Thread