Razor inserts extra space between text blocks. I want to render a list this way: “1, 2, 3” but get “1 , 2 , 3”.
@for (int i = 1; i < 3; i++)
{
<text>@i</text>
if (i != 2)
{
<text>, </text>
}
}
Are there any ways to remove this extra space?
You could use @Html.Raw. The code is more readable and the output doesn’t have extra whitespace