R
R
Roman2021-03-22 16:33:42
JavaScript
Roman, 2021-03-22 16:33:42

Write formatted text to database with output?

ASP.NET Core MVC
Enter text at intervals and paragraphs in the text field, you need to write it to the database so that the formatting is preserved (indents, paragraphs).
Tell me how to do or where is the article?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2021-03-23
@prorom-exe

private static String FormatOutput(string inStr)
    {
        return inStr.Replace("\n","<br/>").Replace(" ","&nbsp;");
    }

because in html all leading spaces and line breaks are cut out.
PS. You can also get confused so that only the leading spaces are cut out. Yes, store as is, and format before output

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question