I am reading a small MSWord document and storing its contents in a string.
There are SOH special characters included in this string. I would like to replace them with a placeholder string, like "#placeholder1" before they are written into a new text (.txt) file. Note that I am not wanting to modify/edit the MSWord document
I'm not sure if string.Replace would suit this or if I need to go a different route. It may just be the parameter I am using for the SOH character.
Suggestions?
There's no reason why what you're doing shouldn't work. Here's a minimal example that you can test on ideone:
using System;
public class Test
{
public static void Main()
{
String s = "\u0001 This is a test \u0001";
s = s.Replace("\u0001","Yay!");
Console.WriteLine(s);
}
}
The only other thing I can think you might be doing wrong, is not storing the result of your call to Replace
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With