Click to See Complete Forum and Search --> : How To Split A String?


BuckleyInDaHouse
April 8th, 2008, 09:20 PM
Im currently working on a C# project that requires the use of proxies.



String WholeProxy = "127.0.0.1:80";
String Address = Here I need to split "WholeProxy" to get just the "127.0.0.1";
int Port = Here I need to split "WholeProxy" to get just the "80";
WebProxy WP = new WebProxy(Address,Port);

Does anyone know how to do this?


Thanks,
BuckleyInDaHouse.

brownkj
April 8th, 2008, 11:05 PM
string[] AddressAndPort = WholeProxy.Split(new Char[] { ':' });
string Address = AddressAndPort[0];
int Port = Convert.ToInt32(AddressAndPort[1]);

BuckleyInDaHouse
April 9th, 2008, 05:08 AM
Wow, thank you so much. This fixed my problem.