I have a List containing Typed entries
Later on in the code I want to find a matching element in the List by its ip, but I don't know what it's efficacy is. Thus, the following doesn't work
How do I locate the matching ip in the List?
BTW,
doesn't work either. Should I be using a Map?
B4X:
Sub Process_Globals
Private restServer As Server
Type Proxy(ip As String, efficacy As Int)
Public proxyList As List
End Sub
Sub AppStart (Args() As String)
proxyList.Initialize()
Dim pList As List
pList = File.ReadList("c:\web\proxies.txt","")
Dim i As Int
For i = 0 To pList.Size - 1
Dim p As Proxy
p.Initialize()
p.ip = pList.Get(i)
p.efficacy = 0
proxyList.Add(p)
Next
B4X:
Case "DELETE" ' Delete
response.Write(request.Method & " " & request.FullRequestURI & "<br>")
ip = request.GetParameter("ip")
Dim pos As Int
pos = Main.proxyList.IndexOf(ip)
response.Write(pos & " for " & ip)
BTW,
B4X:
proxyRec.ip = ip
pos = Main.proxyList.IndexOf(proxyRec)
Last edited: