Toontingy Wrote:I am trying to port some code from C/C++ into Objective-C (doing iphone development) and I wondering if there is a comparable trick as the following:

memory = "foo 100bar";

x = atoi(&memory[0]);
here x is 0

x = atoi(&memory[4]);
here x is 100

Can something be done similar with NSString?

What is the "trick"? You are simply passing atoi a pointer to the beginning of the string (where there are no numbers) or to the fifth character, which is a number. In the first case, it finds nothing to interpret as a number, in the second case it does. Trick? This works the same in ObjC since it is straight C code.