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
原文地址:https://www.cnblogs.com/imtudou/p/11251683.html