0

我有 url。它包含这样的 querstring 值。拆分 url 并将查询字符串值存储在数组中。查询字符串值不会在应用程序中传递。它来自另一个应用程序

url
----
http://.....?lead_id=152818&vendor_id=100001&list_id=1001&gmt_offset_now=0.00&phone_code=91&phone_number=9942321400&title=MR&first_name=Hari&middle_initial=Q&last_name=PUBLIC&address1=249+MUNDON+ROAD&address2=MALDON&address3=FL&city=44&state=TN&province=NO_PROVINCE&postal_code=600004&country_code=IN&gender=M&date_of_birth=0000-00-00&alt_phone=9942321400&email=test@test.com&security_phrase=nothing&comments=COMMENTS&user=22222&pass=test&campaign=OUTBOUND&phone_login=22222&original_phone_login=22222&phone_pass=test&fronter=22222&closer=22222&group=OUTBOUND&channel_group=OUTBOUND&SQLdate=2012-08-07+164931&epoch=1344338372&uniqueid=1344338352.12754&customer_zap_channel=&customer_server_ip=&server_ip=10.103.200.177&SIPexten=22222&session_id=8600062&phone=9942321400&parked_by=152818&dispo=N&dialed_number=9942321400&dialed_label=MAIN&source_id=10001&rank=1&owner=Southeast&camp_script=&in_script=&script_width=600&script_height=340&fullname=J.Hariharan&recording_filename=OUTBOUND_20120807-164911_22222_9942321400&recording_id=248601&user_custom_one=&user_custom_two=&user_custom_three=&user_custom_four=&user_custom_five=&preset_number_a=&preset_number_b=&preset_number_c=&preset_number_d=&preset_number_e=&preset_dtmf_a=&preset_dtmf_b=&session_name=1344338181_2222216466857"



my question is i want to store the querystring values in an one dimensional string 
array.


my code
-------
Dim strarr() As String
    Dim s As String = "http://...../test.aspx?lead_id=152818&vendor_id=100001&list_id=1001&gmt_offset_now=0.00&phone_code=91&phone_number=9942321400&title=MR&first_name=Hari&middle_initial=Q&last_name=PUBLIC&address1=249+MUNDON+ROAD&address2=MALDON&address3=FL&city=44&state=TN&province=NO_PROVINCE&postal_code=600004&country_code=IN&gender=M&date_of_birth=0000-00-00&alt_phone=9942321400&email=test@test.com&security_phrase=nothing&comments=COMMENTS&user=22222&pass=test&campaign=OUTBOUND&phone_login=22222&original_phone_login=22222&phone_pass=test&fronter=22222&closer=22222&group=OUTBOUND&channel_group=OUTBOUND&SQLdate=2012-08-07+164931&epoch=1344338372&uniqueid=1344338352.12754&customer_zap_channel=&customer_server_ip=&server_ip=10.103.200.177&SIPexten=22222&session_id=8600062&phone=9942321400&parked_by=152818&dispo=N&dialed_number=9942321400&dialed_label=MAIN&source_id=10001&rank=1&owner=Southeast&camp_script=&in_script=&script_width=600&script_height=340&fullname=J.Hariharan&recording_filename=OUTBOUND_20120807-164911_22222_9942321400&recording_id=248601&user_custom_one=&user_custom_two=&user_custom_three=&user_custom_four=&user_custom_five=&preset_number_a=&preset_number_b=&preset_number_c=&preset_number_d=&preset_number_e=&preset_dtmf_a=&preset_dtmf_b=&session_name=1344338181_2222216466857"
    strarr = s.Split("?")
    Dim s1 As String = strarr(1)
    Dim constr() As String
    constr = s1.Split("&")


but am not get correct result


my result
---------
list_id=1001
gmt_offset_now=0.00
phone_code=91
phone_number=9942321400


expected result
---------------
  1001
  0.00
  91
  9942321400
4

1 回答 1

0

遍历您的 'constr' 并使用另一个拆分( by '=' )。结果可以存储在 List(of String) 中。

dim r as new list(of String)
for each c in constr
   r.add(c.split("=")(1))
next

(像这样)

要查看此内容,您应该列出“r”内的所有项目,因此您需要另一个。

for each item in r
   console.writeline(item)
next

您也可以在第一个循环中执行此操作。

于 2012-08-10T06:44:43.487 回答