C# 截取字符串 例子:截取ftp地址信息
时间:2011-03-29 来源:Vicky_Chen
string str1 = @"ftp://admin:[email protected]";
int i = str1.IndexOf("//");
int j = str1.LastIndexOf(":");
int k = str1.IndexOf("@");
label1.Text = str1.Substring(i+2, j-i-2);//admin
label2.Text = str1.Substring(j+1,k-j-1);//111
label3.Text = str1.Substring(k+1,str1.Length-k-1);//172.16.145.121
相关阅读 更多 +