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を望む、そう? –