Re: textfield with percent sign
Re: textfield with percent sign
- Subject: Re: textfield with percent sign
- From: Reimar Metzen <email@hidden>
- Date: Sun, 1 Feb 2004 20:38:44 +0100
Hi,
replace % with %%
Reimar
Am 01.02.2004 um 20:20 schrieb emh:
>
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.
[demime 0.98b removed an attachment of type image/jpeg which had a name of upload_73104.jpg]
_______________________________________________
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.