c# - umbraco string trim using razor view -
i have umbraco script im using on site, inside there razor script below:
<p>@page.getproperty("maincontent")</p>
the above in loop, , shows content each post (its being used on landing page blog functionality)
i want trim content outputed getpropery() method 300 charectors.
anyone have ideas?
also, word opposite of concatenate?
you write custom helper:
public static class htmlextensions { public static string truncate(this htmlhelper html, string value, int count) { if (string.isnullorempty(value)) { return string.empty; } if (value.length > count) { value = value.substring(0, count - 1) + "..."; } return value; } }
which used this:
<p>@html.truncate(page.getproperty("maincontent"), 300)</p>
also, word opposite of concatenate?
split
Comments
Post a Comment