Previous | Index | Next |
Substring extraction methods
stringsOfString:inString:options:locale:
Returns an array of all matching substrings. Anchored and backwards search options don't make sense here.
Locale may affect results.
+ (NSArray *)stringsOfString:(NSString *)toFind inString:(NSString *)aString options:(NSStringCompareOptions)compareOptions locale:(NSLocale *)aLocale
toFind = the string to look for
aString = the string to search
compareOptions = Any of the NSStringCompareOptions
aLocale = theLocale to use
A list of matching strings
Version 1.2.0
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 stringsOfString:"string" inString:aString options:(current application's NSCaseInsensitiveSearch)
ASify from theResult
--> {"string", "STRING"}
theResult as list
--> {"string", "STRING"}
set theLocale to current application's NSLocale's localeWithLocaleIdentifier:"tr"
set theResult to current application's SMSForder's stringsOfString:"string" inString:aString options:(current application's NSCaseInsensitiveSearch) locale:theLocale
ASify from theResult
--> {"string"}
theResult as list
--> {"string"}