StateFormatUS
What a validated US state comes back as: the two-letter code or the full name.
CkUS.State understands a state written either way — "ca", "California",
" NEW YORK " — so StateFormatUS never affects what is accepted, only the shape
of the answer. Code gives you the two-letter USPS code (the abbreviation the US
Postal Service puts on mail, like "CA"); Name gives you the full name, like
"California". Codes suit storage and comparisons; names suit anything a person
will read.
Members
| Member | Meaning |
|---|---|
Code |
The two-letter USPS code, e.g. "CA". This is the default. |
Name |
The full name, e.g. "California". |
Where it is used
The State method on CkUS takes it as its output
parameter. That method covers the 50 states, the District of Columbia, the five
inhabited territories and the three military designations, and answers each of
them in whichever shape you ask for.
Quick look
using SafeCoder.CommonKit;
using SafeCoder.CommonKit.Enums;
CkUS.State("california"); // -> "CA" (the code is the default)
CkUS.State(
input: " NEW YORK ",
output: StateFormatUS.Name
); // -> "New York"