use*_*155 -2 iphone xcode objective-c nsstring ipad
我以某种方式错误地使用stringByReplacingCharactersInRange,但我无法理解如何.我的目标是将一个角色替换为另一个角色NSString.我做了很多次,但经过两次更换后,它从NSString的末尾开始切割,我不想这样做.这是我的代码.
NSRange firstCharRange = NSMakeRange(mi, mi); // mi is an int, indicating the index of the replaced char
myword = [myword stringByReplacingCharactersInRange:firstCharRange withString:bb.titleLabel.text]; // myword is the string
Run Code Online (Sandbox Code Playgroud)
最初myword是@"RRRRRRRR",在替换第一个字符串后就成了
eRRRRRRR
Run Code Online (Sandbox Code Playgroud)
然后
egRRRRRR
Run Code Online (Sandbox Code Playgroud)
然后
eghRRRR // why did cut off the last character?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2575 次 |
| 最近记录: |