How to get range of substring in swift3?
let string = "Please Click Here"
I need range of click
Convert to NSString
and user rangeOf
:
let string = "Please Click Here"
let range = (string as NSString).range(of: "Click", options: .caseInsensitive)
print(range)
let string = "Please Click Here"
if let range = string.range(of: "Click") {
print(range)
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With