2015-01-14 90 views
0

我在经典ASP下面的代码:字符串数组与经典ASP

Dim objHttp, strQuery 
strQuery = "https://geoip.maxmind.com/f?333l=2112212&i=" & ipaddress 
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") 
objHttp.open "GET", strQuery, false 
objHttp.send 

Response.Write objHttp.ResponseText 
Set objHttp = Nothing 

这是从一个的MaxMind API来获取他的每一个IP用户的城市/ ZIP。它的工作,但我得到很长的一行:

美国,加利福尼亚州,洛杉矶,90068,34.134499,-328.190804,673,818, “AT &牛逼U型诗句”

任何想法如何我能打破这条线并从中获得某些价值吗?

+0

[检查拆分功能](http://msdn.microsoft.com/zh-cn/library/0764e5w5%28v= vs.84%29.aspx) – SearchAndResQ

回答

6
theArray = Split(objHttp.ResponseText,",") 

for i=0 to uBound (theArray) 
    response.write theArray(i) 
next 

试试看。如果字符串总是处于相同格式,则可以简单地通过说theArray(3)