質問

I have string something like @"goodhouse=30&app=60&val=30askldkla" How can I found the value 30 between house= and &, and change it on 50?

役に立ちましたか?

解決 2

if ([yourString rangeOfString:@"30"].location==NSNotFound) {
yourString = [yourString stringByReplaceOccurenceOfString:@"30" withString@"60"];

}

他のヒント

You can find a range between house= and & string using NSRange. And if range exists, then change the string which you want.

try like this,

string=@"30";
str=[str stringByReplaceOccurenceOfString:string withString@"50"];

EDIT:- try like this,

NSString *test = [dateandtime stringByReplacingCharactersInRange:NSMakeRange(10,2) withString:@"50"];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top