Re: NSString searching for zero
Re: NSString searching for zero
- Subject: Re: NSString searching for zero
- From: Andreas Mayer <email@hidden>
- Date: Sun, 22 Sep 2002 15:19:04 +0200
Am Sonntag, 22.09.02 um 13:48 Uhr schrieb Claudius Sailer:
and this seems a little bit stupid:
if (([text characterAtIndex:0] == 0) && ([text characterAtIndex:1] ==
0) && ([text characterAtIndex:2] == 0) && ([text characterAtIndex:3]
== 0))
What about
[text isEqualToString:@"\0\0\0\0"]; // see 'man printf' for more
escape codes
This will most likely not work for values > 127 though, since those
could be encoded using more than one byte (unicode).
If you are handling non-character data, it may be better to use NSData
instead of NSString.
Or you could use regular C strings and functions for processing
arbitrary data and move to Cocoa classes only when actually working
with text (not byte streams).
bye. Andreas.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.