Ok, so for grabbing the state abbreviation I have this

 <CFSET stateETC = trim(listlast(string))>

 <CFSET stateabbvmatch = listfirst(stateETC, " ")>

 <cfif REFind("^[a-zA-Z]{2}$", stateabbvmatch)>

check stateabbvmatch against database
</CFIF>

1. What if the string is like 'St. Louis, MO'
- Will listfirst(stateETC, " ")> still work? There's no space at the end. So
would it just grab the whole string?

Or should I do like

<CFSET stateabbvmatch = trim(listlast(string))>
<CFSET spaceindex = Find(" ", stateabbvmatch)>
<CFIF spaceindex = 3>
  <CFSET stateabbvmatch = listfirst(stateabbvmatch, " ")>
</CFIF>
<cfif REFind("^[a-zA-Z]{2}$", stateabbvmatch)>


2. in the case there is no state abbreviation match I'd like to go then look
at the string (after the comma) for a possible match for state name

Get string after comma, remove space after comma. Parse out first part of
string (using spaces as delimiter), check if match. If not parse out first
and second part of string (for cases like 'north carolina') check if match.

ex  'St. Louis, Missouri adsfasf' yields 'Missouri' and would yield a match.

ex. 'St. Louis, West Virginia' yields 'west' and does not find match. 2nd
attempted yields 'West Virginia' and does find match.

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 mailing list - http://groups.google.com/group/openbd?hl=en

 !! save a network - please trim replies before posting !!

Reply via email to