Mark Drelinger
asked on
parse out text typed in one text box into two separate text boxes
I have a text box that users paste GPS cordinates into. They enter :
Latitude: 42.079964 / Longitude: -71.869398
into field "GPSCOORDINATES". I would like it parsed out into two separate fields : Latitude & Longitude.
any ideas ?
Regards,
Mark
Latitude: 42.079964 / Longitude: -71.869398
into field "GPSCOORDINATES". I would like it parsed out into two separate fields : Latitude & Longitude.
any ideas ?
Regards,
Mark
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try:
Dim str
str="Latitude: 42.079964 / Longitude: -71.869398"
data = Split(str,"/")
data(0)=split(trim(data(0))," ")
data(1)=split(trim(data(1))," ")
Dim latitude,longitude
If "LATITUDE" = Left(Trim(UCase(data(0)(0))),8) Then
latitude = data(0)(1)
longitude= data(1)(1)
Else
latitude = data(1)(1)
longitude= data(0)(1)
End If
Response.Write( "Lat: " & latitude )
Response.Write( "Long:" & longitude )
ASKER
I think all of the answers would work, but I felt this solution was the best. Thank you.
arrayVairable = Split(FormFieldWithGPS, '/')
this should give you a 2 array variable then you would acccess it like this:
Lattitude = arrayVariable[0]
Longitude = arrayVariable[1]