1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| { NSString *string = @""; NSString *ret = [string stringByReplacingCharactersInRange:NSMakeRange(0, 0) withString:@"因吹斯汀"]; NSLog(@"string:%@\nret:%@", string, ret); } { NSString *string = @"倒计时开关是"; NSString *ret = [string stringByReplacingCharactersInRange:NSMakeRange(0, 0) withString:@"因吹斯汀"]; NSLog(@"string:%@\nret:%@", string, ret); } { NSString *string = @"倒计时开关是"; NSString *ret = [string stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:@"因吹斯汀"]; NSLog(@"string:%@\nret:%@", string, ret); } { NSString *string = @"倒计时开关是"; NSString *ret = [string stringByReplacingCharactersInRange:NSMakeRange(string.length, 0) withString:@"因吹斯汀"]; NSLog(@"string:%@\nret:%@", string, ret); } { NSString *string = @"倒计时开关是"; NSString *ret = [string stringByReplacingCharactersInRange:NSMakeRange(string.length - 1, 1) withString:@"因吹斯汀"]; NSLog(@"string:%@\nret:%@", string, ret); } { NSString *string = @"倒计时开关是"; NSString *ret = [string stringByReplacingCharactersInRange:NSMakeRange(string.length, 1) withString:@"因吹斯汀"]; NSLog(@"string:%@\nret:%@", string, ret); }
|