Substring() 截取


stockInfo.Code = str[0].Substring(str[0].IndexOf("_str_"), str[0].IndexOf("=") - str[0].IndexOf("_str_")).Replace("_str_","");//股票编码


--去掉最后一个字符串
appendStr.Substring(0, appendStr.Length-1)


--C# Substring() 截取字符串的用法
string id = "123456196108047890";
string birthdate = id.Substring(6);      //------------------196108047890
string brithdate = id.Substring(6,8); //--------------------19610804
 
 
 string fileName = "Program.cs";
string strName = fileName.Substring(0,fileName.IndexOf('.'));  //------------Program
string strExten = fileName.Substring(fileName.IndexOf('.'));  //---------------.cs
posted @ 2019-07-26 17:19  无敌土豆  阅读(836)  评论(0编辑  收藏  举报