How would you parse the location text from Twitter to get the latitude/longitude in Objective-C?

Posted by Brennan on Stack Overflow See other posts from Stack Overflow or by Brennan
Published on 2010-04-04T22:18:23Z Indexed on 2010/04/04 22:23 UTC
Read the original article Hit count: 265

Filed under:
|
|

The location text from Twitter could be just about anything. Sometimes Twitter clients set the location with the user's latitude and longitude in the following format.

"\U00dcT: 43.05948,-87.908409"

Since there is no built-in support for Regular Expressions in Objective-C I am considering using the NSString functions like rangeOfString to pull the float values out of this string.

For my current purpose I know the values with start with 43 and 87 so I can key off those values this time but I would prefer to do better than that.

What would you do to parse the latitude/longitude from this string?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about regex