0
Swift 2.0을 3.0으로 마이그레이션 한 후 " '같이 IndexOf를'때문에 '내부'보호 수준에 액세스 할 수 없습니다"스위프트 3 : 나는 문제가 몇 가지 실수를했다'내부'보호 수준으로 인해 'indexOf'에 액세스 할 수 없습니다.
// 코드
var indexIndexed = 0
for link in doc.css("li") {
if(link.className == "regular-search-result"){
for link2 in link.css("span") {
if(link2.className == "indexed-biz-name"){
let num:String = link2.text!
let lastPart = num.substring(to: num.index(num.startIndex, offsetBy: num.indexOf(".")!)) // Here
print("le num est \(lastPart)")
let numInt:Int = Int(lastPart)!
if(numInt > 10 && numInt <= 20){
indexIndexed = numInt - 10
} else if(numInt > 20){
indexIndexed = numInt - 20
} else {
indexIndexed = numInt
}
//print(indexIndexed)
}
}
}
}
스위프트 3에서는 지금 '지수 (".")' –
답장을 보내 주셔서 감사합니다. @nirav-d 'index (of : ".")'사용할 때 :이 오류가 발생했습니다 : '(of :) 인수 레이블이 사용 가능한 오버로드와 일치하지 않습니다. –
문자열에서 분수 부분을 원하십니까? 예를 들어 "12.56"-> 56을 원해, 그렇지? –