Link to home
Start Free TrialLog in
Avatar of Mark Drelinger
Mark DrelingerFlag for United States of America

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
Avatar of brad2575
brad2575
Flag of United States of America image

you can split it into an array

arrayVairable = Split(FormFieldWithGPS, '/')

this should give you a 2 array variable then you would acccess it like this:

Lattitude = arrayVariable[0]
Longitude =  arrayVariable[1]

ASKER CERTIFIED SOLUTION
Avatar of sh0e
sh0e

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hielo
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 )

Open in new window

Avatar of Mark Drelinger

ASKER

I think all of the answers would work, but I felt this solution was the best.  Thank you.