Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.mac.system > #71673
| From | Jolly Roger <jollyroger@pobox.com> |
|---|---|
| Newsgroups | comp.sys.mac.system, alt.comp.lang.applescript |
| Subject | Re: Searching for "fraction slash" |
| Followup-To | alt.comp.lang.applescript |
| Date | 2015-03-20 13:48 +0000 |
| Organization | People for the Ethical Treatment of Pirates |
| Message-ID | <cn2mppFg7j0U6@mid.individual.net> (permalink) |
| References | <isw-D2F299.20370819032015@news-roam.garlic.com> |
Cross-posted to 2 groups.
Followups directed to: alt.comp.lang.applescript
On 2015-03-20, isw <isw@witzend.com> wrote: [Followups set to alt.comp.lang.applescript] > I opened one of the recipes with a hex editor, and found that the > location of the slash contains "\u8260 ". A search revealed that is > "&frasl" in HTML, which is evidently a "fraction slash". The Mac's > Character Viewer thinks that "fraction slash" is U+0066, for what that > is worth. 8260 decimal is 2044 hexadecimal. In AppleScript, you can use the «data utxt» formatter to work with Unicode characters. To get the fraction slash character, you can use: «data utxt2044» as Unicode text > So all I want to do is find the thing so it can be replaced by a > "regular" slash, but I need to know what to tell the AppleScript to look > for, and I don't know how to do that. This seems to work for me: -- begin script property bunchOfText : "this ⁄ is a test of the emergency ⁄ broadcast system please stay ⁄ calm and bring ⁄ your towel" property searchCharacter : «data utxt2044» as Unicode text set newText to my SearchReplace(bunchOfText, searchCharacter, "/") return my SearchReplace(newText, searchCharacter, "***") on SearchReplace(sourceStr, searchString, replaceString) -- replace <searchString> with <replaceString> in <sourceStr> set searchStr to (searchString as text) set replaceStr to (replaceString as text) set sourceStr to (sourceStr as text) set saveDelims to AppleScript's text item delimiters set AppleScript's text item delimiters to (searchString) set theList to (every text item of sourceStr) set AppleScript's text item delimiters to (replaceString) set theString to theList as string set AppleScript's text item delimiters to saveDelims return theString end SearchReplace -- end script The "bunchOfText" property is a string with the Unicode 2044 characters in it (added directly from the keyboard by typing Option-Shift-1. I used the «data utxt» formatter to set the "searchCharacter" property to the single Unicode 2044 character so I can search for it. I typed the « and » characters on the keyboard with Option-\ and Option-Shift-\, respectively. The SearchReplace handler uses an AppleScript text item delimiter trick to locate the substring and replace it. -- E-mail sent to this address may be devoured by my ravenous SPAM filter. I often ignore posts from Google. Use a real news client instead. JR
Back to comp.sys.mac.system | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Searching for "fraction slash" isw <isw@witzend.com> - 2015-03-19 20:37 -0700
Re: Searching for "fraction slash" Your Name <YourName@YourISP.com> - 2015-03-20 18:22 +1200
Re: Searching for "fraction slash" isw <isw@witzend.com> - 2015-03-20 10:59 -0700
Re: Searching for "fraction slash" Savageduck <savageduck1@{REMOVESPAM}me.com> - 2015-03-19 22:36 -0700
Re: Searching for "fraction slash" Jolly Roger <jollyroger@pobox.com> - 2015-03-20 13:48 +0000
Re: Searching for "fraction slash" -- solved isw <isw@witzend.com> - 2015-03-20 15:08 -0700
Re: Searching for "fraction slash" -- solved Savageduck <savageduck1@{REMOVESPAM}me.com> - 2015-03-20 16:40 -0700
Re: Searching for "fraction slash" -- solved Your Name <YourName@YourISP.com> - 2015-03-21 13:19 +1200
Re: Searching for "fraction slash" -- solved Savageduck <savageduck1@{REMOVESPAM}me.com> - 2015-03-20 18:08 -0700
Re: Searching for "fraction slash" -- solved isw <isw@witzend.com> - 2015-03-20 20:21 -0700
Re: Searching for "fraction slash" -- solved Jolly Roger <jollyroger@pobox.com> - 2015-03-21 00:03 +0000
Re: Searching for "fraction slash" -- solved isw <isw@witzend.com> - 2015-03-20 20:20 -0700
Re: Searching for "fraction slash" -- solved Jolly Roger <jollyroger@pobox.com> - 2015-03-21 12:48 +0000
Re: Searching for "fraction slash" -- solved isw <isw@witzend.com> - 2015-03-21 21:47 -0700
Re: Searching for "fraction slash" -- solved Your Name <YourName@YourISP.com> - 2015-03-22 18:00 +1200
Re: Searching for "fraction slash" -- solved Jolly Roger <jollyroger@pobox.com> - 2015-03-22 12:15 +0000
Re: Searching for "fraction slash" -- solved Michelle Steiner <michelle@michelle.org> - 2015-03-22 08:39 -0700
Re: Searching for "fraction slash" -- solved Jolly Roger <jollyroger@pobox.com> - 2015-03-22 15:47 +0000
Re: Searching for "fraction slash" -- solved Lewis <g.kreme@gmail.com.dontsendmecopies> - 2015-03-23 02:54 +0000
Re: Searching for "fraction slash" -- solved dempson@actrix.gen.nz (David Empson) - 2015-03-23 16:51 +1300
Re: Searching for "fraction slash" -- solved Michelle Steiner <michelle@michelle.org> - 2015-03-22 21:42 -0700
Re: Searching for "fraction slash" -- solved Jolly Roger <jollyroger@pobox.com> - 2015-03-23 13:25 +0000
Re: Searching for "fraction slash" -- solved Jolly Roger <jollyroger@pobox.com> - 2015-03-23 13:23 +0000
Re: Searching for "fraction slash" -- solved isw <isw@witzend.com> - 2015-03-22 21:27 -0700
Re: Searching for "fraction slash" -- solved Your Name <YourName@YourISP.com> - 2015-03-21 13:19 +1200
Re: Searching for "fraction slash" -- solved isw <isw@witzend.com> - 2015-03-20 20:16 -0700
Re: Searching for "fraction slash" -- solved Jolly Roger <jollyroger@pobox.com> - 2015-03-21 12:40 +0000
Re: Searching for "fraction slash" -- solved Your Name <YourName@YourISP.com> - 2015-03-22 09:57 +1200
Re: Searching for "fraction slash" -- solved isw <isw@witzend.com> - 2015-03-21 22:09 -0700
Re: Searching for "fraction slash" -- solved Your Name <YourName@YourISP.com> - 2015-03-22 19:19 +1200
csiph-web