This commit is contained in:
Erik 2015-03-18 09:19:22 -04:00
parent 472ba50058
commit c67e7a3003

View File

@ -43,7 +43,7 @@ public class SwiftRegex: NSObject, BooleanType {
}
final var targetRange: NSRange {
return NSRange(location: 0,length: countElements(target))
return NSRange(location: 0,length: target.utf16Count)
}
final func substring(range: NSRange) -> String? {
@ -102,7 +102,7 @@ public class SwiftRegex: NSObject, BooleanType {
let mut = NSMutableString(string: target)
mut.replaceCharactersInRange(match.rangeAtIndex(groupno), withString: replacement)
target = mut
target = mut as String
}
}
}
@ -154,7 +154,7 @@ public class SwiftRegex: NSObject, BooleanType {
out.appendString(substring( NSRange(location:pos, length:targetRange.length-pos))!)
return out
return out as String
}
public var boolValue: Bool {
@ -206,4 +206,4 @@ public func ~= (left: SwiftRegex, right: ([String]?) -> String) -> String {
return left.substituteMatches({match, stop -> String in
return right(left.groupsForMatch(match))
}, options: nil)
}
}