LoginSignup
3
3

More than 5 years have passed since last update.

ObjC to Swift : [NSString rangeOfString:] - NSNotFound

Last updated at Posted at 2015-05-04

Objective-C

NSString * nsString = @"NSString type";
NSRange range = [nsString rangeOfString( @"type" )];
BOOL exist = ( range.location != NSNotFound );

Swift

let swiftString = "Swift String type"
let range = swiftString.rangeOfString( "type" )
let exist = ( range != nil )
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3