Emil
Emil

Reputation: 7256

Return array value as NSString

How can you return an array value (witch is a number) as a string?

Current code:

return [numbers objectAtIndex:row];

Have also tried:

return @"%@", [numbers objectAtIndex:row];

With no luck..

Thanks :) PS: Yes, I am stupid. (:

Upvotes: 1

Views: 599

Answers (1)

kennytm
kennytm

Reputation: 523304

return [[numbers objectAtIndex:row] description];

In C / ObjC / C++ / Javascript / D / many other C-based languages, the comma operator does not create an array / tuple.

(a,b,c,d,e)

is similar to

e

(while evaluating a and b and c and d as a side-effect).

Upvotes: 3

Related Questions