Assuming your array contains ASCII fixnum representation of characters, messaging #pack('c*') on it should give you a string object back.

You can look up the documentation of Array#pack for more information.

I dislike this method, but here I don't see a better choice.

Laurent 

On Jan 10, 2011, at 1:08 PM, Joel Reymont wrote:

I would like to do

mungedRegistration = [...]
registrationString = NSString.stringWithUTF8String(mungedRegistration)

but this results in

can't convert Array into String (TypeError)

What is the best approach here?

I do need my munged registration to be an array since I'm initializing it with numbers and then do calculations on these numbers to convert them into character values.

Thanks, Joel

---
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont





_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel