swifter-tips / Public-Issues

Public issues for Swifter-tips book
103 stars 3 forks source link

正则表达式函数错误 #75

Closed porridgec closed 7 years ago

porridgec commented 7 years ago

正则表达式一节,书中的代码是:

let matches = regex.matchesInString(input,
                    options: [],
                    range: NSMakeRange(0, input.utf16.count))

但是Swift 3中应为

let matches = regex.matches(in: input,
                    options: [],
                    range: NSMakeRange(0, input.utf16.count))
onevcat commented 7 years ago

感谢指出,尽快修正!

porridgec commented 7 years ago

哇喵神回复好快