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

  • SEARCH
  • Home
  • 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 8033755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:47:55+00:00 2026-06-05T01:47:55+00:00

I have a long string I want to retrieve from a URL and store

  • 0

I have a long string I want to retrieve from a URL and store at app launch. Later, I want to insert individual values into that string.

I’d like to do something like this:

NSString *numberLine = @"1 %@ 3 %@ 5 %@";

//... (later) ...

NSString *final = [NSString stringWithFormat:numberLine, @"two", @"four", @"six"]; 

NSLog(@"%@", final); //Should output "1 two 3 four 5 six"

I want the @"two" to be inserted into the placeholder %@ that was earlier saved into numberLine.

Is there a good way to accomplish something like this?

So far my only thought is to do something like:

NSString *script = @"width = PLACEHOLDERpx";
script = [script stringByReplacingOccurrencesOfString:@"PLACEHOLDER" withString:@"12"];
  • 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-05T01:47:57+00:00Added an answer on June 5, 2026 at 1:47 am

    What you are describing is a template. You want to leave placeholders in a string that will be filled out with data. While you could use %@ and %d through a string that gets difficult as the string grows more complex. You may want to use a template library like Mustache for Objective-C. This will let you write expressions like this:

    Hello {{SomeVariable}}
    

    All you have to do is pass in an NSDictionary with keys that correspond to the data you want to render. So for the example above you might do the following:

    NSString *result = [GRMustacheTemplate renderObject:[NSDictionary dictionaryWithObject:@"World" forKey:@"SomeVariable"];
                                             fromString:@"Hello {{SomeVariable}}"
                                                  error:NULL];
    

    This will produce a result string Hello World.

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

Sidebar

Related Questions

I have an unsigned long long value which I want to store into an
I have a long string that I want to parse and retrieve a value.
i have a long string variable and i want to search in it for
I have a very long String and I want to read character by character
I have a simple question. I have a long std::string that I want to
I have a long string (multiple paragraphs) which I need to split into a
I have a long string of comments that I'd like to split into multiple
I have a long string that I want to encode to ascii. I'm doing:
I have a long string of some characters. I want to replace some chars
I want to retrieve the last row from the data store so how can

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.