Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Reverse geocode

dickthedevdickthedev Posts: 214Registered Users @ @
Hello, I am working on a reverse geocode app. I need to have an output of the actual address, Such as street number, street name etc. In my reverse geocode, I have:

text = [NSString stringWithFormat:@%@", ABCreateStringWithAddressDictionary(placemark.addressDictionary, NO)];
NSLog(@%@",text);

The output of the address is in three lines:
666 Hellish St
Infernal City CA 66666
United States@

How can I make it into a one line output like
666 Hellish St Infernal City CA 66666 United States@

Replies

  • dev666999dev666999 Posts: 3,567New Users @ @ @ @ @
    edited October 2016
    dickthedev wrote: »
    Hello, I am working on a reverse geocode app. I need to have an output of the actual address, Such as street number, street name etc. In my reverse geocode, I have:

    text = [NSString stringWithFormat:@%@", ABCreateStringWithAddressDictionary(placemark.addressDictionary, NO)];
    NSLog(@%@",text);

    The output of the address is in three lines:
    666 Hellish St
    Infernal City CA 66666
    United States@

    How can I make it into a one line output like
    666 Hellish St Infernal City CA 66666 United States@

    Your address is separated by "\n" delimiters to give separate lines correctly formatted.

    So, try this on your output...

    myNewText=[text stringByReplacingOccurrencesOfString:@\n withString:@ ];

    "\n" replace that with " "

    For some reason I can't get it to show correctly with or without code flags.


    https://developer.apple.com/reference/foundation/nsstring/1412937-stringbyreplacingoccurrencesofst?language=objc
    Post edited by dev666999 on
  • dickthedevdickthedev Posts: 214Registered Users @ @
    Thank you for your reply. It works.:)
  • dev666999dev666999 Posts: 3,567New Users @ @ @ @ @
    Glad to hear it. :)
Sign In or Register to comment.