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 6362013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:51:09+00:00 2026-05-24T23:51:09+00:00

I have a response from server which is NSString and looks like this resp=handshake&clientid=47D3B27C048031D1&success=true&version=1.0

  • 0

I have a response from server which is NSString and looks like this

resp=handshake&clientid=47D3B27C048031D1&success=true&version=1.0

I want to convert it to key value pair , something like dictionary or in an array .
I couldn’t find any useful built-in function for decoding the NSString to NSdictionary and replacing the & with space didn’t solve my problem , can anyone give me any idea or is there any function for this problem ?

  • 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-05-24T23:51:09+00:00Added an answer on May 24, 2026 at 11:51 pm

    This should work (off the top of my head):

    NSMutableDictionary *pairs = [NSMutableDictionary dictionary];
    
    for (NSString *pairString in [str componentsSeparatedByString:@"&"]) {
        NSArray *pair = [pairString componentsSeparatedByString:@"="];
    
        if ([pair count] != 2)
            continue;
    
        [pairs setObject:[pair objectAtIndex:1] forKey:[pair objectAtIndex:0]];
    }
    

    or you could use an NSScanner, though for something as short as a query string the extra couple of arrays won’t make a performance difference.

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

Sidebar

Related Questions

Hi I am getting a response from server which is something like this {total:110,responses:{13:26,14:24,15:40,16:20}}
I have generic async task class which fetches response from server . And i
I have an ExtJs form which upon receiving a response from server shows a
I have got the response from server which I have stored in the list.I
I have the following array response from a server to an android app. [
I have been looking at the answer to this question: Pulling details from response
I have a url which have a response in Json lon=-0.1275&pg=0 I parsed the
I am getting some response from server side which i need to parse but
If I want to have an ExpandableListView, which gets data from a response from
I have a method which fetches data from server. I'm calling the method several

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.