how can i find range of a string in another string swift
let str = "abcde"
if let range = str.range(of: "cd") {
let substring = str[..<range.lowerBound] // or str[str.startIndex..<range.lowerBound]
print(substring) // Prints ab
}
else {
print("String not present")
}
Also in Swift:
- uiimageview add tap gesture swift
- uitextfield placeholder text
- swift update uilabel text button
- swift animate a label ishidden
- remove cocoapods swiftr
- textField.characther range
- xcode macosx have view resize when window size changed
- loop through array swift
- run a function only once swift
- swift table view needs
- xcode label rotate text
- how to bold 1 word swift
- swift assign tuple to variables
- how to screen record swift stackoverflow
- xcode enable a button after a text field is filled
- add to beginning of array swift
- view will appear
- presentviewcontroller must be set swift google login
- swift double v float
- custom binding swiftui
- detect binding valu change swiftui
- swift edit constraint programmatically
- register page
- use timer swift