有没有一种情况,当 range.location > targetString.length, range.length !=0
Is there a situation that when range.location > targetString.length, range.length !=0
- 有没有可能当
range.location > targetString.length
然后range.length !=0
?
- 判断范围变量是否存在的最佳方法是什么?
无效的 NSRange
将 location
成员设置为 NSNotFound
(即 NSIntegerMax
),因此:
- 是的,当范围无效时,但是在那种情况下
length
成员应该被忽略。
- 如果 "exists" 你的意思是 "valid",就是
location != NSNotFound
.
- 有没有可能当
range.location > targetString.length
然后range.length !=0
? - 判断范围变量是否存在的最佳方法是什么?
无效的 NSRange
将 location
成员设置为 NSNotFound
(即 NSIntegerMax
),因此:
- 是的,当范围无效时,但是在那种情况下
length
成员应该被忽略。 - 如果 "exists" 你的意思是 "valid",就是
location != NSNotFound
.