Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you can't get the abbreviations of the states but you can make your own class for this..</p> <ul> <li>List all the states(states are standards)</li> <li>compare those states and return the abbreviation</li> </ul> <p><strong>Code..</strong></p> <p>Class StateAbbreviation</p> <p>StateAbbreviation.h</p> <pre><code>@interface StateAbbreviation : NSString { } + (NSString *)allStates:(int)index; + (NSString *)abbreviatedState:(NSString *)strState; @end </code></pre> <p>StateAbbreviation.m</p> <pre><code>@implementation StateAbbreviation + (NSString *)allStates:(NSString *)strState { // Remove all space on the string strState = [strState stringByReplacingOccurrencesOfString:@" " withString:@""]; //Sample states NSArray *states = [[NSArray alloc] initWithObjects: @"ALABAMA", @"ALASKA", //AK @"AMERICANSAMOA", //AS @"ARIZONA", //AZ @"ARKANSAS", //AR @"CALIFORNIA", //CA nil]; NSUInteger n = [states indexOfObject:strState]; if (n &gt; [states count] - 1) { strAbbreviation = @"NOSTATE"; } else { strAbbreviation =[self abbreviatedState:n]; } [states release]; return strAbbreviation; } + (NSString *)abbreviatedState:(int)index { NSArray *states = [[NSArray alloc] initWithObjects: @"AL", @"AK", @"AS", @"AZ", @"AR", @"CA", nil]; NSString *strAbbreviation = [states objectAtIndex:index]; [states release]; return strAbbreviation; } @end </code></pre> <p>When you call the class it should be something like this</p> <pre><code>NSString *upperCase = [@"California" uppercaseString]; // California could be from (NSString *)placemark.administrativeArea; NSString *abbr = [StateAbbreviation allStates:upperCase]; NSLog(@"%@", abbr); // Result should be CA </code></pre> <p>This are only samples you can research all states something like this, <a href="http://state.1keydata.com/state-abbreviations.php" rel="nofollow">states and their abbreviations</a> also like this <a href="http://www.hamariplace.com/50-states-of-america-usa-capitals-and-largest-city/" rel="nofollow">states and their abbreviations</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload