A string thing i cannot figure out
-
:confused:I have an Excel automation engine that collects data from a specified cell in the Execel worksheet. Well when I get the data back and parse it based on a "," I get the following string from the worksheet "\"devbng:BNGDetail\"". Well I need to get rid of the '\' and the extra '"'. Well I have tried everything i could think of I wrote the following _serverName.Replace("\\",""); _serverName.Replace('\"',' '); But no avail, well any help would be greatly appreciated. Thanks
-
:confused:I have an Excel automation engine that collects data from a specified cell in the Execel worksheet. Well when I get the data back and parse it based on a "," I get the following string from the worksheet "\"devbng:BNGDetail\"". Well I need to get rid of the '\' and the extra '"'. Well I have tried everything i could think of I wrote the following _serverName.Replace("\\",""); _serverName.Replace('\"',' '); But no avail, well any help would be greatly appreciated. Thanks
There's a Remove method also, isn't there ? Christian Graus - Microsoft MVP - C++
-
:confused:I have an Excel automation engine that collects data from a specified cell in the Execel worksheet. Well when I get the data back and parse it based on a "," I get the following string from the worksheet "\"devbng:BNGDetail\"". Well I need to get rid of the '\' and the extra '"'. Well I have tried everything i could think of I wrote the following _serverName.Replace("\\",""); _serverName.Replace('\"',' '); But no avail, well any help would be greatly appreciated. Thanks
Ignore this entire post if _serverName is not a string object. Strings are immutable, so the code you have now is essentially a no-op, i.e. it's returning a new instance of a string that is not being stored by anything, and the original value of _serverName is unchanged. Have you tried: _serverName = _servername.Replace("\\", "");