Previous | Index | Next |
Offset vs Range methods
offsetOfLocation:inString:
Convert a Cocoa location or NSRange to an AppleScript index
+ (NSUInteger)offsetOfLocation:(NSNumber *)location inString:(NSString *)aString
location = a location in an NSString
aString = a string
An integer
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 offsetOfLocation:2 inString:aString
--> 3
set theResult to current application's SMSForder's offsetOfLocation:4 inString:aString
--> 4