Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8845197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:40:49+00:00 2026-06-14T11:40:49+00:00

NSString *string = [myString stringByReplacingOccurrencesOfString:@<wow> withString:someString]; I have this code. Now suppose my app’s

  • 0
NSString *string  = [myString stringByReplacingOccurrencesOfString:@"<wow>" withString:someString];

I have this code. Now suppose my app’s user enters two different strings I want to replace with two different other strings, how do I achieve that? I don’t care if it uses private APIs, i’m developing for the jailbroken platform. My user is going to either enter or or . I want to replace any occurrences of those strings with their respective to-be-replaced-with strings 🙂

Thanks in advance 😛

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:40:50+00:00Added an answer on June 14, 2026 at 11:40 am

    Both dasblinkenlight’s and Matthias’s answers will work, but they both result in the creation of a couple of intermediate NSStrings; that’s not really a problem if you’re not doing this operation often, but a better approach would look like this.

    NSMutableString *myStringMut = [[myString mutableCopy] autorelease];
    [myStringMut replaceOccurrencesOfString:@"a" withString:somethingElse];
    [myStringMut replaceOccurrencesOfString:@"b" withString:somethingElseElse];
    // etc.
    

    You can then use myStringMut as you would’ve used myString, since NSMutableString is an NSString subclass.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this in my code : NSString *myString = @; .... if (...)
I have a string! NSString *myString=[NSString stringWithFormat:@This is my lovely string]; What I want
I need help filtering NSStrings. Suppose I have a string called myString. NSString *myString
I have a problem with this code : __strong NSString *yourString = @Your String;
Let's assume I have the string NSString* myString = @Hello,; How can I remove
I have a string value. NSString *myString = @Latitude:-31.9504140#Longitude:115.8606040; How can I retrieve the
I am confused between NSString and NSMutable string usage. Suppose I have instance variables
I have a string input by the user, this is string is treated to
I really can't find this answer... I have multiline NSString called myString in XCode,
I have 2 new questions: 1) Consider this line: NSString *myString = [[NSString alloc]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.