Pregunta

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?

¿Fue útil?

Solución 2

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

}

Otros consejos

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"];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top