views:

19

answers:

1

I have an array full of place names. One for eg is "Tower Of London" i want to put it on the end of http://en.wikipedia.org/wiki/ and open it.

how do i change the spaces to underscores.. eg 'Tower of London' to 'Tower_of_London'?

any ideas appreciated as always :)

Cheers

+1  A: 

I got it - for future reference

NSString *myString = [[NSString alloc] init];
NSString *myEditedString = [[NSString alloc] init];
myString = [array objectAtIndex:myInteger];
myEditedString = [myString stringByReplacingOccurrencesOfString:@" " withString:@"_"];

u can replace bits of a string. in this case i replaced spaces with _

BUT this could be used for anything... so if u had a mass typo in every obeject of a large array.. this is an effective 'find and replace' filter you can put in place.

Sam

Sam Jarman