I have a string that is obtained from a webpage that is an address. This address can be in several different states
1. blank
2. street address, city state and zip
3. city state and zip
4. 2 and 3 with no zip
5. have coordinates either above or below that i want disregarded or stored in a separate variable
6. Address can be put in with ---Street address--- city state zip but i have only seen this once
My problem is that I am getting confused with javascript and autohotkey. I know how to do in javascript but then I dont see how i would assign to an autohotkey variable
so without further ado, here is my code, Please help
Code: Select all
ProjLoc := "1585 Tower road <br>Cortland, NY 13045"
FoundLoc := RegExMatch(ProjLoc, "<br>")
if (PanelLoc = "")
{
break
} else {
if (FoundLoc = 0) ;No <br>, therefore no street address, just city, state and possibly zip
{
StreetAdd := "" ;or just dont include it?
City := ProjLoc.split(,)[0]
StateAndZip := ProjLoc.split(,)[1]
;check if zip code included
FoundSpace := RegExMatch(StateAndZip, " ")
if (FoundSpace = 0) ;No space " " therefore no zip
{
State := StateAndZip
Zip := "" ;or just dont include it?
} else { ;zip included
State := StateAndZip.split(" ")[0]
Zip := StateAndZip.split(" ")[1]
}
} else{ ;break is there, therefore has street address
StreetAdd := ProjLoc.split(<br>)[0]
City := ProjLoc.split(<br>)[1].split(,)[0]
StateAndZip := ProjLoc.split(<br>)[1].split(,)[1]
FoundSpace := RegExMatch(StateAndZip, " ")
if (FoundSpace = 0) ;No space " " therefore no zip
{
State := StateAndZip
Zip := "" ;or just dont include it?
} else { ;zip included
State := StateAndZip.split(" ")[0]
Zip := StateAndZip.split(" ")[1]
}
}
}