-1
我試過的是使用for-in循環,但是隻循環到最後一個值,並給出rangeOfString的值。爲我想要的所有值編寫rangeOfString會很多,但如果需要,我不介意。我只是想知道是否可以使用數組。是否有可能從數組中的一組項目中獲取rangeOfString?
while true {
let attempts = ["hello","goodbye"]
for attempt in attempts{
tru = attempt
let range = text.rangeOfString("hello", options: [], range: searchRange)