Search Results for

    Show / Hide Table of Contents
    View Source

    Class HtmlStringUtilities

    Provides utility methods for UmbracoHelper for working with strings and HTML in views.

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Web.Common.Mvc
    Assembly: Umbraco.Web.Common.dll
    Syntax
    public sealed class HtmlStringUtilities

    Methods

    View Source

    Coalesce(Object[])

    Declaration
    public string Coalesce(params object[] args)
    Parameters
    Type Name Description
    System.Object[] args
    Returns
    Type Description
    System.String
    View Source

    Concatenate(Object[])

    Declaration
    public string Concatenate(params object[] args)
    Parameters
    Type Name Description
    System.Object[] args
    Returns
    Type Description
    System.String
    View Source

    Join(String, Object[])

    Declaration
    public string Join(string separator, params object[] args)
    Parameters
    Type Name Description
    System.String separator
    System.Object[] args
    Returns
    Type Description
    System.String
    View Source

    ReplaceLineBreaks(String)

    HTML encodes the text and replaces text line breaks with HTML line breaks.

    Declaration
    public IHtmlContent ReplaceLineBreaks(string text)
    Parameters
    Type Name Description
    System.String text

    The text.

    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent

    The HTML encoded text with text line breaks replaced with HTML line breaks (<br />).

    View Source

    StripHtmlTags(String, String[])

    Declaration
    public HtmlString StripHtmlTags(string html, params string[] tags)
    Parameters
    Type Name Description
    System.String html
    System.String[] tags
    Returns
    Type Description
    Microsoft.AspNetCore.Html.HtmlString
    View Source

    Truncate(String, Int32, Boolean, Boolean)

    Declaration
    public IHtmlContent Truncate(string html, int length, bool addElipsis, bool treatTagsAsContent)
    Parameters
    Type Name Description
    System.String html
    System.Int32 length
    System.Boolean addElipsis
    System.Boolean treatTagsAsContent
    Returns
    Type Description
    Microsoft.AspNetCore.Html.IHtmlContent
    View Source

    WordsToLength(String, Int32)

    Returns the length of the words from a HTML block

    Declaration
    public int WordsToLength(string html, int words)
    Parameters
    Type Name Description
    System.String html

    HTML text

    System.Int32 words

    Amount of words you would like to measure

    Returns
    Type Description
    System.Int32
    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • Coalesce(Object[])
      • Concatenate(Object[])
      • Join(String, Object[])
      • ReplaceLineBreaks(String)
      • StripHtmlTags(String, String[])
      • Truncate(String, Int32, Boolean, Boolean)
      • WordsToLength(String, Int32)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX