i am trying to separate the IP from the port in a list box. but i am only leaving the port number and ":" how would i make it so the ":" is removed and only the IP is left.
ips look like this:
192.168.0.12:80
192.168.0.2:123
192.168.0.3:1337
for (int i = 0; i < lb.Items.Count; i++)
{
string item = lb.Items[i] as string;
item = item.Substring(item.LastIndexOf(":"));
lb.Items[i] = item;
}
Run Code Online (Sandbox Code Playgroud)