Mike P wrote:
Found the answer :
foreach(DataRow dr in ds.Tables["LeadDetails"].Rows)
{
dr["Activity"] = dr["Activity"].ToString().Replace("\r", "");
dr["Activity"] = dr["Activity"].ToString().Replace("\n", "");
dr["Activity"] = dr["Activity"].ToString().Replace("\t", "");
}
*** Sent via Developersdex http://www.developersdex.com ***
You do a lot of indexing and converting for no reason. You don't have to
put the value back for each operation.
foreach(DataRow dr in ds.Tables["LeadDetails"].Rows) {
dr["Activity"] = ((string)dr["Activity"]).Replace("\r",
string.Empty).Replace("\n", string.Empty).Replace("\t", string.Empty);
}
or using the Regex class:
foreach(DataRow dr in ds.Tables["LeadDetails"].Rows) {
Regex.Replace((string)dr["Activity"], "[\\r\\n\\t]", string.Empty);
}
--
Göran Andersson
_____
http://www.guffa.com