url = [url stringByReplacingOccurrencesOfString:@"id=" withString:@"id=d"];
Replace String not work
-
28-11-2021 - |
Pregunta
I need to add the string @"d" after "id="
Example =
url = @"id=63488320543140151742289377"
needs to be
url = @"id=d63488320543140151742289377"
I have tried this:
NSRange range = [url rangeOfString:@"id="];
[url stringByReplacingCharactersInRange:range withString:@"id=d"];
but not work
Solución
Otros consejos
stringByReplacingCharactersInRange
returns a string. Your code should work if you assign the new string that's returned to some variable (e.g. url = [url stringByReplacingCharactersInRange:range withString:@"id=d"];
)
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow