Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to get multiple value from an array into string separate by comma
    primarykey
    data
    text
    <p>i was trying to insert a string into database having multiple value using componentsSeparatedByString:@",". I am getting all the values in "arrayp1net" but problem is how to make a string that contains all the values of array "arrayp1net" separated by comma (,)?</p> <pre><code>if(p1h &lt; 18) { for(int k=0;k&lt;[arrayp1 count];k++) { if([[hcar1 objectAtIndex:1]intValue] &gt;= [[ar33 objectAtIndex:k] intValue]) { NSString *str = [NSString stringWithFormat:@"%d",[[[arrayp1 objectAtIndex:k] text] intValue] -1]; [arrayp1net addObject:str]; } else { NSString *str = [NSString stringWithFormat:@"%d",[[[arrayp1 objectAtIndex:k] text]intValue]]; [arrayp1net addObject:str]; player1netscore = [NSString stringWithFormat:@"%@",arrayp1net]; } } </code></pre> <p>yes i need the same but i have to insert in database in one row of a column with query, so that when i am going to fetch, i fetch all as it is.</p> <pre><code>query=[NSString stringWithFormat:@"insert into normalscoring (gameid,coursename,p1,p2,p3,p4,p1s,p2s,p3s,p4s,gameDate,p1nets,p2nets,p3nets,p4nets) values (\'%@\',\'%@\',\'%@||%@\',\'%@||%@\',\'%@||%@\',\'%@||%@\', ',,,,,,,,,,,,,,,,,||0||0||0||0', ',,,,,,,,,,,,,,,,,||0||0||0||0', ',,,,,,,,,,,,,,,,,||0||0||0||0', ',,,,,,,,,,,,,,,,,||0||0||0||0', \'%@\',',,,,,,,,,,,,,,,,,', ',,,,,,,,,,,,,,,,,',',,,,,,,,,,,,,,,,,',',,,,,,,,,,,,,,,,,')", txtgameid.text,txtcoursename.text,txtplayer1.text,player1handicap, txtplayer2.text,player2handicap,txtplayer3.text,player3handicap, txtplayer4.text,player4handicap,txtdate.text]; </code></pre> <p>here is what i am trying to do after if statement but getting exception</p> <pre><code>player1netscore = [NSString stringWithFormat:@"%@",arrayp1net]; arn11=[player1netscore componentsSeparatedByString:@","]; player1netscore=[[arn11 objectAtIndex:0] objectForKey:@"p1nets"]; NSLog(@"player1netscore...%@",player1netscore); </code></pre>
    singulars
    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.
 

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