• 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: Coercing ligatures to expanded characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coercing ligatures to expanded characters


  • Subject: Re: Coercing ligatures to expanded characters
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 13 Jan 2017 11:10:55 +1100

On 13 Jan 2017, at 6:45 am, Jacob Small <email@hidden> wrote:

Is there an easier way to do this?

There are more efficient ways. For example:

on removeLigaturesFromString(inputStringWithLigatures)
set searchStrings to {"Ꜳ", "ꜳ"} -- add the rest here
set replaceStrings to {"AA", "aa"} -- add the rest here
set saveTID to AppleScript's text item delimiters
considering case
repeat with i from 1 to count of searchStrings
set AppleScript's text item delimiters to {item i of searchStrings}
set inputStringWithLigatures to text items of inputStringWithLigatures
set AppleScript's text item delimiters to {item i of replaceStrings}
set inputStringWithLigatures to inputStringWithLigatures as text
end repeat
end considering
set AppleScript's text item delimiters to saveTID
return replaceStrings
end removeLigaturesFromString

Here's an alternative for extracting the email addresses:

use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

on findEmailAddressesIn:someString
set theDD to current application's NSDataDetector's dataDetectorWithTypes:(current application's NSTextCheckingTypeLink) |error|:(missing value)
set theURLs to theDD's matchesInString:someString options:0 range:{location:0, |length|:length of theContent}
set thePredicate to current application's NSPredicate's predicateWithFormat:"self.URL.scheme == 'mailto'"
set theURLs to theURLs's filteredArrayUsingPredicate:thePredicate
set theURLs to theURLs's valueForKeyPath:"URL.resourceSpecifier"
set theURLs to (current application's NSSet's setWithArray:theURLs)'s allObjects()
return theURLs as list
end findEmailAddressesIn:



-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


 _______________________________________________
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: Coercing ligatures to expanded characters
      • From: Takaaki Naganoya <email@hidden>
References: 
 >Coercing ligatures to expanded characters (From: "Jacob M. Small" <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: "Jacob M. Small" <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: Jacob Small <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: Denis Boyd <email@hidden>)
 >Re: Coercing ligatures to expanded characters (From: Jacob Small <email@hidden>)

  • Prev by Date: Re: Coercing ligatures to expanded characters
  • Next by Date: Re: Coercing ligatures to expanded characters
  • Previous by thread: Re: Coercing ligatures to expanded characters
  • Next by thread: Re: Coercing ligatures to expanded characters
  • Index(es):
    • Date
    • Thread