views:

44

answers:

2

Hi all.

I am getting value in search box from user and storing it in NSstring *searchWord;

I want that when user typed let say "Lady Gaga" then I Replace the space with % just like that searchWord=searchbar.text;

  now search word has "lady gaga"

 I want to replace it with.
  searchword=@"lady%gaga";
+5  A: 

Hello !

You could try this :

NSString *newString = [ @"lady gaga" stringByReplacingOccurrencesOfString:@" " withString:@"%"];

It should work :-)

Vinzius
ok thanks got it
Nauman.Khattak
+1 just tested it and it does work.
Meta-Knight
+1  A: 

-[NSString replaceOccurrencesOfString:withString:options:range:]

John Franklin