textfield with percent sign
textfield with percent sign
- Subject: textfield with percent sign
- From: emh <email@hidden>
- Date: Sun, 1 Feb 2004 11:20:05 -0800
hi all,
new to the list (and cocoa/objc development) but i couldn't find any
answers in either online docs or list archives.
i have a textfield where i want the user to input a search phrase. i
then plan on appending that phrase to the URL of a search engine, i.e.
NSString* searchterm = [textfield stringValue];
NSString* urlStr = [NSString
stringWithFormat:@"
http://www.blah.com/search?select=&for=%@",
searchTerm];
the problem is, if the user types in something like "%@" for the
searchterm, the program blows up. it looks like it is treating the % as
a formatting character.
how do i stop it from doing that?
i tried using the stringByAddingPercentEscapesUsingEncoding method on
NSString but that only provided bizarre results -- maybe i used the
wrong encoding (i tried ASCII and UTF8).
any help would be appreciated!
also, note that this doesn't have much to do with the URL stuff -- a
simple NSLog(searchTerm) will blow up the app if searchTerm is "%@".
evan.
_______________________________________________
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.