转大小写: ToUpper() , ToLower
stringstrPath=textBox1.Text.Substring(0,textBox1.Text.LastIndexOf(""));
stringstrName=textBox1.Text.Substring(textBox1.Text.LastIndexOf("")+1,(textBox1.Text.LastIndexOf(".")-textBox1.Text.LastIndexOf("")-1));
stringstrEName=textBox1.Text.Substring(textBox1.Text.LastIndexOf(".")+1,(textBox1.Text.Length-textBox1.Text.LastIndexOf(".")-1))
//判断后缀名是否为excel. 如果不是则更改为 xls
int i = excelFileName.LastIndexOf('.')+1;
String postfixName = excelFileName.Substring(i);
if (postfixName.ToLower() == "csv")
{
excelFileName = excelFileName.Substring(0, i);
excelFileName += "xls";
}
string excelCon = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Jet OLEDB:Engine Type=35;Extended Properties=Excel 8.0;HDR=Yes;IMEX=1;Persist Security Info=False", excelFileName);
String 纯数字 如何快速去掉前面的0
string str = "000230423423 ";
string r = @ "[1-9]\d+ ";
str = System.Text.RegularExpressions.Regex.Match(str, r).ToString(); //提取信息
string a= "000123003 ";
a=Regex.Replace(a, "^0+ ", " ");
整型转字符型,不足6位的在前面补0
23.ToString().PadLeft(6,'0');