I have the following code
string line = \"\";
while ((line = stringReader.ReadLine()) != null)
{
// split the lines
for (int c = 0; c < line.Len
You can use String.Replace which basically removes all occurrences
line.Replace(@"\", "");
Try to replace
string result = line.Replace("\\","");
while ((line = stringReader.ReadLine()) != null)
{
// split the lines
for (int c = 0; c < line.Length; c++)
{
line = line.Replace("\\", "");
lineBreakOne = line.Substring(1, c - 2);
lineBreakTwo = line.Substring(c + 2, line.Length - 2);
}
}
Trim
only removes characters at the beginning and the end of the string, that's why your code doesn't quite work. You should use Replace
instead:
line.Replace(@"\", string.Empty);
You could use:
line.Replace(@"\", "");
or
line.Replace(@"\", string.Empty);
Why not simply this?
resultString = Regex.Replace(subjectString, @"\\", "");