练习手写代码!
先输入!
Console.WriteLine("请输入地址");
//或者直接用192.168.10.5[port=21,type=ftp]
string str=Console.ReadLine();
char[] remove={'[',']',',','='};
string[] strs=str.Split(remove,StringSpiltOptions.RemoveEmptyEntries);
string IP=strs[0];
string port=strs[2];
string type;
if(strs.Length>3)
type=strs[4];
else
type="http";
Console.WriteLine("ip地址为{0},端口为{1},接口类型为{2}",IP,port,type);
Console.Readkye();
|