Previous Index Next

BridgePlus.framework, SMSForder Class Methods

Category

Substring range methods

Method

rangesOfString:inString:options:

Summary

Returns an array of NSRanges, representing the range of every instance of the search string. Anchored and backwards search options don't make sense here.

Signature

+ (NSArray *)rangesOfString:(NSString *)findString inString:(NSString *)aString options:(NSStringCompareOptions)options

Parameters

findString = string to look for

aString = string to search

options = NSStringCompareOptions

Result

An array of range values

Availability

Version 1.2.0

Notes

 

Sample

use scripting additions

use framework "Foundation"

use script "BridgePlus"

load framework


set aString to "This is a string. And this also part of the String."

set theResult to current application's SMSForder's rangesOfString:"string" inString:aString options:((current application's NSCaseInsensitiveSearch) + (current application's NSDiacriticInsensitiveSearch as integer))

ASify from theResult

--> {{location:10, length:6}, {location:44, length:6}}

theResult as list

--> {{location:10, length:6}, {location:44, length:6}}


Click here to open script in a script editor