Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

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")
}
Comment

find range of string swift

let string = "Please Click Here"
if let range = string.range(of: "Click") {
   print(range)

}
Comment

PREVIOUS NEXT
Code Example
Swift :: swift 5 to upper 
Swift :: uilabel set fon siz 
Swift :: ForEach tabs swiftui 
Swift :: swift remove all pins from mapkit 
Swift :: UIFont.init bold 
Swift :: accessing tab bar item action swift 
Swift :: hstack spacing swiftui 
Swift :: swift extension Array of type 
Swift :: swift replace newlines with space 
Swift :: Swift Loop Over Array 
Swift :: swift make enum inspectable 
Swift :: swift ui view 
Swift :: share local storage wkwebview swift 
Swift :: swift go to main thread 
Swift :: Type Constraints Swift 
Swift :: how to debug before app launch swift 
Swift :: Swift Operators 
Swift :: how to check if something is in a set in swift 
Swift :: Swift Code Reusability 
Swift :: swift check if class is of type 
Swift :: Swift Nested Tuple 
Swift :: xib image shown on simulator but not on device 
Swift :: selector cannot call in notification observer swift 
Swift :: swift writing to ios logs 
Swift :: page view controller disable swipe 
Swift :: how to figure out ios vesion swift 
Ruby :: how to delete a table in rails 
Ruby :: getting wanked off by ruby 
Ruby :: rails video_tag with <source 
Ruby :: http request ruby 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =