How can I Unescape and Reescape strings in .net?

Posted by firoso on Stack Overflow See other posts from Stack Overflow or by firoso
Published on 2010-04-18T04:45:25Z Indexed on 2010/04/18 4:53 UTC
Read the original article Hit count: 533

So here's my situation. I am working on an editor for a communications channel that works over an RS232 serial ASCII terminal. Let's not go into detail for that ;-) To simplify, I need a textbox on a WPF control that can take in text like "Commit\r\n" (which is the .net string "Commit\r\n") and convert it back to "Commit\r\n" as a .net string. I was hoping for a string.Unescape() and string.Escape() method pair, but it doesn't seem to exist. Am I going to have to write my own? or is there a more simple way to do this?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about strings