AppleScript名:ASOCで文字置換5 |
— Created 2015-06-30 by Takaaki Naganoya use AppleScript version "2.4" use scripting additions use framework "Foundation" set a to "あいうえお++かきくけこ" set b to cleanUpText(a, "+", "●") –> "あいうえお●●かきくけこ" on cleanUpText(someText, targStr, repStr) set theString to current application’s NSString’s stringWithString:someText set targString to current application’s NSString’s stringWithString:targStr set repString to current application’s NSString’s stringWithString:repStr set theString to theString’s stringByReplacingOccurrencesOfString:targString withString:repString options:(current application’s NSRegularExpressionSearch) range:{location:0, |length|:length of someText} return theString as text end cleanUpText |
More from my site
(Visited 61 times, 1 visits today)