s.Substring(0,s.Length - 1)这里的s.Length - 1有什么作用string s = comboBox2.Text + '/' + listView3.SelectedItems[0].Text;string m = s.Substring(0,s.Length - 1);comboBox2.Text = m;listView3.Items.Clear();fangfa(@"ftp://hhhh@219.220.112.130"+m)
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/30 00:36:17
![s.Substring(0,s.Length - 1)这里的s.Length - 1有什么作用string s = comboBox2.Text + '/' + listView3.SelectedItems[0].Text;string m = s.Substring(0,s.Length - 1);comboBox2.Text = m;listView3.Items.Clear();fangfa(@](/uploads/image/z/7286429-29-9.jpg?t=s.Substring%280%2Cs.Length+-+1%29%E8%BF%99%E9%87%8C%E7%9A%84s.Length+-+1%E6%9C%89%E4%BB%80%E4%B9%88%E4%BD%9C%E7%94%A8string+s+%3D+comboBox2.Text+%2B+%27%2F%27+%2B+listView3.SelectedItems%5B0%5D.Text%3Bstring+m+%3D+s.Substring%280%2Cs.Length+-+1%29%3BcomboBox2.Text+%3D+m%3BlistView3.Items.Clear%28%29%3Bfangfa%28%40%22ftp%3A%2F%2Fhhhh%40219.220.112.130%22%2Bm%29)
s.Substring(0,s.Length - 1)这里的s.Length - 1有什么作用string s = comboBox2.Text + '/' + listView3.SelectedItems[0].Text;string m = s.Substring(0,s.Length - 1);comboBox2.Text = m;listView3.Items.Clear();fangfa(@"ftp://hhhh@219.220.112.130"+m)
s.Substring(0,s.Length - 1)这里的s.Length - 1有什么作用
string s = comboBox2.Text + '/' + listView3.SelectedItems[0].Text;
string m = s.Substring(0,s.Length - 1);
comboBox2.Text = m;
listView3.Items.Clear();
fangfa(@"ftp://hhhh@219.220.112.130"+m);
s.Substring(0,s.Length - 1)这里的s.Length - 1有什么作用string s = comboBox2.Text + '/' + listView3.SelectedItems[0].Text;string m = s.Substring(0,s.Length - 1);comboBox2.Text = m;listView3.Items.Clear();fangfa(@"ftp://hhhh@219.220.112.130"+m)
s.Length 是s字符串变量的长度,-1的意思的截取到倒数二数,整个意思就是截取s字符串“得到”最后一个字符 .
至于前面的那个0就是从第一个开始截取,一般索引是从0开始的.