Skip to main content

Posts

Showing posts with the label casting

get ascii code from string in xcode for iphone app

hey just a couple quick noob questions about writing my first ios app. Ive been searching through the questions here but they all seem to address questions more advanced than mine so im getting confused. (1) All I want to do is turn a string into an array of integers representing the ASCII code. In other words, I want to convert: "This is some string. It has spaces, punctuation, AND capitals." into an array with 62 integers. (2) How do I get back from the NSArray to a string? (3) Also, are these expensive operations in terms of memory or computation time? It seems like it might be if we have to create a new variable at every iteration or something. I know how to declare all the variables and im assuming I run a loop through the length of the string and at each iteration I somehow get the character and convert it into a number with some call to a built in command. Thanks for any help you can offer or links to posts that might help!