I feel like I must be missing a keyword or something when searching since I can't seem to find anyone else looking for this....
I have a string in c# that has line breaks, spaces, tabs etc and I want to display it on my html page in MVC, but keep the formatting instead of losing all the whitespace.
I first used some regex to put line breaks in, but before moving on to try and replace all other possible white space with the appreciate spacing in html, it seems like there would be a class or library already built to do this.
Does anyone know how I can easily convert a c# string to html and keep the white space?
Thanks.
just render it inside of a <pre>
tag
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