嗨,我有个这样的弦
NSString *str=@"1,2,3,4";
我必须从它中删除任何字符 < 坚固 > 动力 坚固 > 。 例如, < code_" 3, " 。
嗨,我有个这样的弦
NSString *str=@"1,2,3,4";
我必须从它中删除任何字符 < 坚固 > 动力 坚固 > 。 例如, < code_" 3, " 。
NSString *str=@"1,2,3,4";
[str stringByReplacingOccurrencesOfString:@"3," withString:@""];
这将删除 str
中的所有@"3" 。
如果您只想要删除@ "3" 的第一次发生, 只需删除 :
NSString* str = @"1,2,3,4";
NSRange replaceRange = [str rangeOfString:@"3,"];
if (replaceRange.location != NSNotFound){
NSString* result = [str stringByReplacingCharactersInRange:replaceRange withString:@""];
}
希望这能帮上忙
NSString *str=@"1,2,3,4";
int numberToRemove = 4;
str = [str stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%d",numberToRemove] withString:@""];
str = [str stringByReplacingOccurrencesOfString:@",," withString:@","];
这会有帮助的
这对我有用,如果有人愿意帮忙的话!
NSString *newStr = @"";
newStr = [str stringByReplacingOccurrencesOfString:@"3," withString:@""];
I have a UIToolbar that needs three buttons in a radio style, meaning that of the three, only one button can be pushed at a time. The documentation makes reference to the possibility of setting up ...
I have a UITextField that is a subview of a UITableViewCell. When my view loads, I want the text field to become first responder. I have a pointer to the text field in the table cell, so to do this I ...
I want to allow the user to enter a valid date using the iPhone’s settings application. I have experimented with many of the PreferenceSpecifiers data node types including date. I have two issues: ...
I m going to use an example to properly illustrate my confusion. I can t quite wrap my head around this. In Cocoa touch, we have UIViewController and its subclass, UINavigationController. Now, UIVC ...
Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...
I have an app which has to load some data at startup, so I want to display a splash-screen animation. I m using the MPMoviePlayerController to play a m4v file. The movie has it s background set to [...
Is there a way to add a location from an MKMapView in my application to the built-in Google Maps app? From what I understand there is probably one of two ways to do it: using [[UIApplication ...
I m trying to chain animation events. The application I m coding for work has a multiple choice quiz. First you pick your multiple choice answer. The quiz view fades away. Then a label ("correct" or "...