objective c - NSData subStringFromIndex: Equivalent -


i'm receiving stream of nsdata characters around @ least 50 characters. usually, try , convert nsstring , use substringfromindex: selector, seems nsstring null terminating (correct me if i'm wrong) , i'd rather skip data / string conversion. know if there way charecter @ specific index in nsdata? example, data returned is:

<12345678 9abcdefg hjiklmno> 

lets 7 , 8 out, , 2 alone. 7 , 8, i've looked trying this:

nsdata *datatrimmed = [data subdatawithrange:nsmakerange(7, -19)]; 

works charm. issue is, stream going different length. 100 characters or 50, know 2 values need located @ 42nd , 43rd spot. have example of or know best way this?

i wonder code negative length not crash.

to 2 bytes @ position 42, 43, use

nsdata *datatrimmed = [data subdatawithrange:nsmakerange(42, 2)]; 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -