问题描述
大家好,
当我尝试从Excel工作表中读取字符串时,我正在将字符串格式跟随到数组[0]中.通过split('','')我正在得到
"\" Title \值.任何人都可以建议我如何从中取消" \"
[0] ="\"标题\,\"名字\,\"中间名\,\"姓氏\,\"后缀\,\"公司\,\"部门\, \职位名称\",\商业街\",\商业街2 \",\商业街3 \",\商业城市\",\商业州\",商业邮政编码" ,\"业务国家/地区...
谢谢
Hi all,
When I try to read strings from excel sheet I am getting following format of strings in to an array[0].Through split('','') I am getting
"\"Title\" value. Can any one please advice me how to suppress "\" from it
[0] = "\"Title\",\"First Name\",\"Middle Name\",\"Last Name\",\"Suffix\",\"Company\",\"Department\",\"Job Title\",\"Business Street\",\"Business Street 2\",\"Business Street 3\",\"Business City\",\"Business State\",\"Business Postal Code\",\"Business Country/Regi...
Thanks
推荐答案
arrString[0] = arrString[0].Replace("\"",string.Empty);
然后,进行拆分.
Then, do your split.
字符串aspdotnet,serverName,domainName,domainExtension;
aspdotnet = "www.aspdotnet.in" ;
string [] arr = aspdotnet.Split(''.'');
serverName = Convert.ToString(arr [0]);
domainName = Convert.ToString(arr [1]);
domainExtension = Convert.ToString(arr [2]);
输出:
serverName ="www"
domainName ="aspdotnet"
domainExtension ="in"
有关更多信息,此链接可能对您有帮助
有关更多信息,此链接可能会对您有所帮助
单击此处.
string aspdotnet, serverName, domainName, domainExtension;
aspdotnet = "www.aspdotnet.in";
string[] arr = aspdotnet.Split(''.'');
serverName = Convert.ToString(arr[0]);
domainName = Convert.ToString(arr[1]);
domainExtension = Convert.ToString (arr[2]);
OUT PUT :
serverName ="www"
domainName ="aspdotnet"
domainExtension="in"
For more information this link may help you
For more information this link may help you
Click here.
string value = "shirt\r\ndress\r\npants\r\njacket";
//
// Use a new char[] array of two characters (\r and \n) to break
// lines from into separate strings. Use "RemoveEmptyEntries"
// to make sure no empty strings get put in the string[] array.
//
char[] delimiters = new char[] { '\r', '\n' };
string[] parts = value.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
这篇关于如何在字符串上使用分割功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!