FROM : Drarok Ithaqua
DATE : Fri Jul 21 00:47:10 2006
I've looked around for a while, and found some posts on CocoaDev, but
nothing seems simple.
I'm looking for basic string searching functionality, like PHP's
strpos() [http://uk.php.net/strpos].
Or rather, I want to know if a string is contained inside another
string. if strpos() returns > -1 (or !== FALSE in PHP)
then the string is at the returned position.
But all I could find was NSString Categories that did a very long
winded method, and had a comment with the following code
(Adapted for my app, natch)
if (([[incomingText componentsSeparatedByString:@"(Quit)"] count] -
1) > 0) {
// It's in the string
};
All I want to know is if the text "(Quit)" is in the incomingText
NSString instance. Surely this can't be the right way?
Thanks for any help.
- Drarok
DATE : Fri Jul 21 00:47:10 2006
I've looked around for a while, and found some posts on CocoaDev, but
nothing seems simple.
I'm looking for basic string searching functionality, like PHP's
strpos() [http://uk.php.net/strpos].
Or rather, I want to know if a string is contained inside another
string. if strpos() returns > -1 (or !== FALSE in PHP)
then the string is at the returned position.
But all I could find was NSString Categories that did a very long
winded method, and had a comment with the following code
(Adapted for my app, natch)
if (([[incomingText componentsSeparatedByString:@"(Quit)"] count] -
1) > 0) {
// It's in the string
};
All I want to know is if the text "(Quit)" is in the incomingText
NSString instance. Surely this can't be the right way?
Thanks for any help.
- Drarok
| Related mails | Author | Date |
|---|---|---|
| Drarok Ithaqua | Jul 21, 00:47 | |
| Andreas Mayer | Jul 21, 01:00 | |
| James Bucanek | Jul 21, 01:46 | |
| Drarok Ithaqua | Jul 21, 02:04 |






Cocoa mail archive

