日期:2014-05-18 浏览次数:20862 次
XmlDocument doc = new XmlDocument();
            doc.LoadXml("...");
            XmlNode root = doc.DocumentElement;
            XmlNode node = root.SelectSingleNode("newnode/datatable");
            if (node != null)
            {
              string value = node.InnerText.Replace(";","");
             }
------解决方案--------------------
如果就单纯的去掉;就像1楼的就行。
但是要想取得里面的单个的值,就用split函数
XmlDocument doc = new XmlDocument();
           doc.LoadXml("...");
           XmlNode root = doc.DocumentElement;
           XmlNode node = root.SelectSingleNode("newnode/datatable");
           if (node != null)
           {
             string value = node.InnerText;
            }  
string [] str = valve.split(";");
这样的话,在 str[0]里的值就是Details;在 str[1]里的值就是Data_Test; 在 str[2]里的值就是Data_Log ;
------解决方案--------------------
这样的话,在 str[0]里的值就是“Details”在 str[1]里的值就是“Data_Test” 在 str[2]里的值就是“Data_Log”
------解决方案--------------------
//注意字符中不要有!就OK了
public string[] split(string st, string pattern)
{
   st.replace(st, pattern, '!');
   return st.split('!');
}
------解决方案--------------------
//注意字符中不要有!就OK了  
public string[] split(string st, string pattern)  
{  
   st.replace(st, pattern, "!");  
   return st.split('!');  
}
------解决方案--------------------
ToString()
------解决方案--------------------
上面写的replace 我写的好像有点错误啊 replice(oldstr, pattern)
作为变量传值有俩种方式:ref out
声明:
public void fun(ref str)
{
}
pulbic void fun(out str)
{
}
在调用俩种方式申明的函数之前必须先申明参数
ref申明的必须调用之前是有值的
调用函数之后
str的值会随着fun()的调用发生变换
或者 你用个return str
也可以得到自己所要的值