Answers for "how to turn index(_rawBits:)into int in siwft"

0

how to turn index(_rawBits:)into int in siwft

//swift 4-5
let text = "abc"
let index2 = text.index(text.startIndex, offsetBy: 2) //will call succ 2 times
let lastChar: Character = text[index2] //now we can index!

let characterIndex2 = text.index(text.startIndex, offsetBy: 2)
let lastChar2 = text[characterIndex2] //will do the same as above

let range: Range<String.Index> = text.range(of: "b")!
let index: Int = text.distance(from: text.startIndex, to: range.lowerBound)
Posted by: Guest on June-01-2020

Code answers related to "how to turn index(_rawBits:)into int in siwft"

Browse Popular Code Answers by Language