Reputation: 77
I still newbie in VB programming and I have a question. I wanted to make a filter for countries so then french people download my app and start it, I want then they start program, this program identify their country and translate program to their language (french). I maked translation and country but I have some problems with 2 things.
I use this code to get their IPv4 (external)
Using wb As New WebClient Dim s As String = wb.DownloadString("http://www.whatsmyip.us/showipsimple.php") TextBox1.Text = s End Using
How can I make that then textbox will receive it, filtre to receive only IP (without document.write("");)
After textbox receive IP, with this app (http://ipinfodb.com/ip_location_api.php) programm will need to receive date from api site (I will use code like above) but I still have same problem. Can I filter OK;;xx.xxx.xx.xxx;US;UNITED STATES to receive only US or UNITED STATES?
Upvotes: 0
Views: 167
Reputation: 9888
Try something like this:
Dim s As String = "OK;;xx.xxx.xx.xxx;US;UNITED STATES"
Dim aux() As String = s.Split(";"c)
Dim countryCode As String = aux(3)
Dim countryName As String = aux(4)
Or you can do something like this:
Dim s As String = "OK;;xx.xxx.xx.xxx;US;UNITED STATES"
Dim countryName = s.SubString(s.LastIndexOf(";"c) + 1)
Upvotes: 2