diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 6d5e33b239..165b81daba 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -1081,66 +1081,121 @@ namespace Umbraco.Web return text.ToMd5(); } + /// + /// Strips all html tags from a given string, all contents of the tags will remain. + /// public HtmlString StripHtml(IHtmlString html, params string[] tags) { return StripHtml(html.ToHtmlString(), tags); } + + /// + /// Strips all html tags from a given string, all contents of the tags will remain. + /// public HtmlString StripHtml(DynamicNull html, params string[] tags) { return new HtmlString(string.Empty); } + + /// + /// Strips all html tags from a given string, all contents of the tags will remain. + /// public HtmlString StripHtml(string html, params string[] tags) { return _stringUtilities.StripHtmlTags(html, tags); } - + + /// + /// Will take the first non-null value in the collection and return the value of it. + /// public string Coalesce(params object[] args) { return _stringUtilities.Coalesce(args); } + /// + /// Will take the first non-null value in the collection and return the value of it. + /// public string Concatenate(params object[] args) { return _stringUtilities.Concatenate(args); } + /// + /// Joins any number of int/string/objects into one string and seperates them with the string seperator parameter. + /// public string Join(string seperator, params object[] args) { return _stringUtilities.Join(seperator, args); } + /// + /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// public IHtmlString Truncate(IHtmlString html, int length) { return Truncate(html.ToHtmlString(), length, true, false); } + + /// + /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// public IHtmlString Truncate(IHtmlString html, int length, bool addElipsis) { return Truncate(html.ToHtmlString(), length, addElipsis, false); } + + /// + /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// public IHtmlString Truncate(IHtmlString html, int length, bool addElipsis, bool treatTagsAsContent) { return Truncate(html.ToHtmlString(), length, addElipsis, treatTagsAsContent); } + + /// + /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// public IHtmlString Truncate(DynamicNull html, int length) { return new HtmlString(string.Empty); } + + /// + /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// public IHtmlString Truncate(DynamicNull html, int length, bool addElipsis) { return new HtmlString(string.Empty); } + + /// + /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// public IHtmlString Truncate(DynamicNull html, int length, bool addElipsis, bool treatTagsAsContent) { return new HtmlString(string.Empty); } + + /// + /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// public IHtmlString Truncate(string html, int length) { return Truncate(html, length, true, false); } + + /// + /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// public IHtmlString Truncate(string html, int length, bool addElipsis) { return Truncate(html, length, addElipsis, false); } + + /// + /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// public IHtmlString Truncate(string html, int length, bool addElipsis, bool treatTagsAsContent) { return _stringUtilities.Truncate(html, length, addElipsis, treatTagsAsContent); @@ -1151,10 +1206,17 @@ namespace Umbraco.Web #region If + /// + /// If the test is true, the string valueIfTrue will be returned, otherwise the valueIfFalse will be returned. + /// public HtmlString If(bool test, string valueIfTrue, string valueIfFalse) { return test ? new HtmlString(valueIfTrue) : new HtmlString(valueIfFalse); } + + /// + /// If the test is true, the string valueIfTrue will be returned, otherwise the valueIfFalse will be returned. + /// public HtmlString If(bool test, string valueIfTrue) { return test ? new HtmlString(valueIfTrue) : new HtmlString(string.Empty);