Load this page inside it's real home
 StateCode
 Get state name or abbreviation from name or abbreviation

FUNCky 6.0®
COM Component


 Syntax
obj.StateCode( State )

Part

Description

obj A FUNCky Object created by a previous call to CreateObject.
State A string containing the state name or abbreviation to use.

 Returns
A string containing the state name or abbreviation.
 Description
StateCode is used to convert a full state name to its 2 digit abbreviation or a 2 digit state abbreviation to its full name.

StateCode accomplishes this by taking the supplied state name and comparing its length to 2. If the length of the supplied state name is 2 characters it is assumed to be a state abbreviation. The state abbreviation is then looked up in the appropriate internal state name table. If a match is found its ordinal position is then used to look up the full state name in the corresponding full state name table. Once the full state name is found it is returned as a string.

If the supplied state name is longer than 2 characters it is assumed to be a full state name and the opposite process is done.

The state name or abbreviation to look up is specified as a string via the parameter State.

 Example

Str = FUNCky.StateCode("NY")            // Result = "New York"

Str = FUNCky.StateCode("New York")      // Result = "NY"

Str = FUNCky.StateCode("CA")            // Result = "California"

Str = FUNCky.StateCode("AC")            // Result = "" (Error)
 See Also IsZip State IsState

Copyright© 1988-2010 dLESKO® Inc. All rights reserved.