I am writing an ASP.NET MVC application. I have a page that renders a table with a foreach
statement.
One of the lines is a text I want to split in different <BR>
depending on the content
I want to split in each ;
I have.. So I am using
@foreach (var model in Model.pagins) { <td> @Html.Raw(Html.Encode(model.Description).Replace(";", "<br />"))</td> }
When the text is like this "aaa;bbb;ccc;ddd"
it works fine. It shows
aaa <br> bbb <br> ccc <br> ddd
But when the text has a "+"
it also split the "+"
. If I have "a+aa;bb+b;ccc;ddd"
. It shows
a+ <br> aa <br> bb+ <br> b <br> ccc <br> ddd
Why this is happening? How can I split it without this problem?
Thanks
model.Description
with "a+aa;bb+b;ccc;ddd", do you still get the same issue? Note that I am using ASP.NET MVC (.Net Framework 4.7.2).