Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to convert this array into a dictionary, as soon as you receive it, and discard the array, as it's useless:</p> <pre><code>#import &lt;Foundation/Foundation.h&gt; int main(int argc, const char **argv) { @autoreleasepool { NSArray *arr = [NSArray arrayWithObjects:@"", @"user_ucurrency_code=USD", @"user_currency_symbol=$", @"usertypecode=ROBT", @"player_level=1", @"player_isblocked=false", @"lang=en", @"respond=true", @"flylogin=false", @"str=PageEnd", @"user_balance=100000394.90", @"user_bonus_balance=0.00", @"first_name=test", @"cash_balance=100000394.90", @"coupon_balance=0.00", @"str=PageEnd", @"remain_GameCount=0", @"remain_PTAmount=0.00", @"real_user_balance=100000394.90", @"fun_user_balance=95725.15", @"user_bonus_balance=0.00", @"bonusstatus=false", @"bonus_id=null", nil]; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; for (NSString *str in arr) { NSArray *elements = [str componentsSeparatedByString:@"="]; if ([elements count] != 2) continue; [dict setValue:[elements objectAtIndex:1] forKey:[elements objectAtIndex:0]]; } for (NSString *key in dict) { NSLog(@"'%@' = '%@'", key, [dict objectForKey:key]); // or valueForKey: } } return 0; } $ clang -o test test.m -fobjc-arc -framework Foundation $ ./test 2013-09-02 12:01:53.811 test[51144:707] 'bonusstatus' = 'false' 2013-09-02 12:01:53.836 test[51144:707] 'lang' = 'en' 2013-09-02 12:01:53.837 test[51144:707] 'cash_balance' = '100000394.90' 2013-09-02 12:01:53.837 test[51144:707] 'flylogin' = 'false' 2013-09-02 12:01:53.838 test[51144:707] 'str' = 'PageEnd' 2013-09-02 12:01:53.838 test[51144:707] 'usertypecode' = 'ROBT' 2013-09-02 12:01:53.839 test[51144:707] 'player_isblocked' = 'false' 2013-09-02 12:01:53.839 test[51144:707] 'player_level' = '1' 2013-09-02 12:01:53.839 test[51144:707] 'respond' = 'true' 2013-09-02 12:01:53.840 test[51144:707] 'remain_PTAmount' = '0.00' 2013-09-02 12:01:53.840 test[51144:707] 'fun_user_balance' = '95725.15' 2013-09-02 12:01:53.841 test[51144:707] 'remain_GameCount' = '0' 2013-09-02 12:01:53.841 test[51144:707] 'user_balance' = '100000394.90' 2013-09-02 12:01:53.842 test[51144:707] 'user_currency_symbol' = '$' 2013-09-02 12:01:53.842 test[51144:707] 'bonus_id' = 'null' 2013-09-02 12:01:53.842 test[51144:707] 'coupon_balance' = '0.00' 2013-09-02 12:01:53.843 test[51144:707] 'real_user_balance' = '100000394.90' 2013-09-02 12:01:53.843 test[51144:707] 'user_bonus_balance' = '0.00' 2013-09-02 12:01:53.848 test[51144:707] 'first_name' = 'test' 2013-09-02 12:01:53.871 test[51144:707] 'user_ucurrency_code' = 'USD' </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload