Previous | Index | Next |
Offset vs Range methods
offsetsOfRange:inString:
Converts from a Cocoa range to AppleScript offsets
+ (NSArray *)offsetsOfRange:(NSRange)range inString:(NSString *)aString
range =
aString = a string
Returns a list of two values, being the first and last character offsets
Version 1.0.0
use scripting additions
use framework "Foundation"
use script "BridgePlus"
load framework
set aString to "A 😀 string."
set theResult to current application's SMSForder's offsetsOfRange:{location:0, |length|:6} inString:aString
ASify from theResult
--> {1, 5}
theResult as list
--> {1, 5}