Search Results for

    Show / Hide Table of Contents
    View Source

    Class DefaultShortStringHelperConfig

    Provides configuration for the DefaultShortStringHelper.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Strings
    Assembly: Umbraco.Core.dll
    Syntax
    public class DefaultShortStringHelperConfig
    Remarks

    This class manages culture-specific and string-type-specific configurations for cleaning and transforming strings.

    Constructors

    View Source

    DefaultShortStringHelperConfig()

    Declaration
    public DefaultShortStringHelperConfig()

    Properties

    View Source

    DefaultCulture

    Gets or sets the default culture to use for string operations.

    Declaration
    public string DefaultCulture { get; set; }
    Property Value
    Type Description
    string
    View Source

    UrlReplaceCharacters

    Gets or sets the dictionary of character replacements for URL generation.

    Declaration
    public Dictionary<string, string>? UrlReplaceCharacters { get; set; }
    Property Value
    Type Description
    Dictionary<string, string>

    Methods

    View Source

    ApplyUrlReplaceCharacters(string)

    Returns a new string in which characters have been replaced according to the Umbraco settings UrlReplaceCharacters.

    Declaration
    public string ApplyUrlReplaceCharacters(string s)
    Parameters
    Type Name Description
    string s

    The string to filter.

    Returns
    Type Description
    string

    The filtered string.

    View Source

    Clone()

    Creates a deep copy of this configuration.

    Declaration
    public DefaultShortStringHelperConfig Clone()
    Returns
    Type Description
    DefaultShortStringHelperConfig

    A new DefaultShortStringHelperConfig instance with the same settings.

    View Source

    CutMaxLength(string, int)

    Cuts a string to a maximum length.

    Declaration
    public static string CutMaxLength(string text, int length)
    Parameters
    Type Name Description
    string text

    The text to cut.

    int length

    The maximum length.

    Returns
    Type Description
    string

    The original text if shorter than or equal to length; otherwise, the first length characters.

    View Source

    WithConfig(string?, CleanStringType, Config)

    Adds or updates a configuration for a specific culture and string role.

    Declaration
    public DefaultShortStringHelperConfig WithConfig(string? culture, CleanStringType stringRole, DefaultShortStringHelperConfig.Config config)
    Parameters
    Type Name Description
    string culture

    The culture to configure, or null for the default culture.

    CleanStringType stringRole

    The string role to configure.

    DefaultShortStringHelperConfig.Config config

    The configuration to set.

    Returns
    Type Description
    DefaultShortStringHelperConfig

    This instance for method chaining.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when config is null.

    View Source

    WithConfig(CleanStringType, Config)

    Adds or updates a configuration for the default culture and a specific string role.

    Declaration
    public DefaultShortStringHelperConfig WithConfig(CleanStringType stringRole, DefaultShortStringHelperConfig.Config config)
    Parameters
    Type Name Description
    CleanStringType stringRole

    The string role to configure.

    DefaultShortStringHelperConfig.Config config

    The configuration to set.

    Returns
    Type Description
    DefaultShortStringHelperConfig

    This instance for method chaining.

    View Source

    WithConfig(Config)

    Adds or updates a configuration for the default culture and all string roles.

    Declaration
    public DefaultShortStringHelperConfig WithConfig(DefaultShortStringHelperConfig.Config config)
    Parameters
    Type Name Description
    DefaultShortStringHelperConfig.Config config

    The configuration to set.

    Returns
    Type Description
    DefaultShortStringHelperConfig

    This instance for method chaining.

    View Source

    WithDefault(RequestHandlerSettings)

    Sets the default configuration.

    Declaration
    public DefaultShortStringHelperConfig WithDefault(RequestHandlerSettings requestHandlerSettings)
    Parameters
    Type Name Description
    RequestHandlerSettings requestHandlerSettings
    Returns
    Type Description
    DefaultShortStringHelperConfig

    The short string helper.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX