Suppose there is a string @ "Hello". Let's say I need to delete the "e". How to do it right? I know only the position of the letter is equal to 1
3 answers
NSMutableString *s = [@"Hello" mutableCopy]; NSRange range = NSMakeRange(1, 1); // первый аргумент - позиция буквы, второй количество символов [s deleteCharactersInRange:range];
|
NSString *hello = @"Hello"; hello = [hello stringByReplacingOccurrencesOfString:@"Hello" withString:@"Hllo"];
|
NSString *helloStr = @"Hello"; helloStr = [helloStr stringByReplacingOccurrencesOfString:@"e" withString:@""];
|