GsFindFirstState - geostan_1 - 2024.01

GeoStan Geocoding Suite Reference for Windows, Linux, and z/OS

Product type
Software
Portfolio
Locate
Product family
GeoStan Geocoding Suite
Product
GeoStan Geocoding Suite > GeoStan
Version
2024.01
Language
English
Product name
GeoStan
Title
GeoStan Geocoding Suite Reference for Windows, Linux, and z/OS
Copyright
2024
First publish date
1994
Last updated
2024-07-29
Published on
2024-07-29T23:01:18.924000

Finds the first state matching the name, abbreviation, or valid ZIP Code.

Syntax

GsFunStat GsFindFirstState (GsId gs, gs_const_str statePattern,pstr stateFound, int bufSize);

Arguments

GsId gs   ID returned by GsInitWithProps() for the current instance of GeoStan. Input.

gs_const_strstatePattern   Search string for the state. Input.

   Can be any of the following items:

n A five-digit ZIP Code.

n The first three digits of a ZIP Code known as the Sectional Center Facility (SCF).

n Various state abbreviations and spellings. For example, for New Hampshire, it accepts: N HAMP, N HAMPSHIRE, NEW HAMPSHIRE, NEWHAMPSHIRE, NH, and NHAMPSHIRE.

pstrstateFound   Proper state abbreviation for the located state. Output.

intbufSize   Maximum length of data returned in stateFound, including NULL. Input.

Return Values

GS_ERROR

GS_SUCCESS

GS_NOT_FOUND

Prerequisites

GsInitWithProps() and GsClear()

Notes

This function returns the proper abbreviation for the requested state. You can request states by ZIP Code, full state name, or an alternate abbreviation

Before each find function, call GsClear() to reset the internal buffers. If you do not reset the buffers, you may receive incorrect results with information from a previous find.

Example

/* This example prints the official state abbreviation for ZIP Code 80301. */
                         
char StateAbbr[3];
GsFunStat iStat;
                         
iStat = GsFindFirstState(gs, "80301", StateAbbr, sizeof(StateAbbr));
if (iStat == GS_SUCCESS)
printf("%s\n", StateAbbr);