Search Results for

    Show / Hide Table of Contents
    View Source

    Class DefaultShortStringHelper

    New default implementation of string functions for short strings such as aliases or URL segments.

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Core.Strings
    Assembly: Umbraco.Core.dll
    Syntax
    public class DefaultShortStringHelper : IShortStringHelper
    Remarks

    Not optimized to work on large bodies of text.

    Meant to replace LegacyShortStringHelper where/when backward compatibility is not an issue.

    NOTE: pre-filters run before the string is re-encoded.

    Constructors

    View Source

    DefaultShortStringHelper(IOptions<RequestHandlerSettings>)

    Declaration
    public DefaultShortStringHelper(IOptions<RequestHandlerSettings> settings)
    Parameters
    Type Name Description
    IOptions<RequestHandlerSettings> settings
    View Source

    DefaultShortStringHelper(DefaultShortStringHelperConfig)

    Declaration
    public DefaultShortStringHelper(DefaultShortStringHelperConfig config)
    Parameters
    Type Name Description
    DefaultShortStringHelperConfig config

    Methods

    View Source

    CleanString(String, CleanStringType)

    Cleans a string.

    Declaration
    public string CleanString(string text, CleanStringType stringType)
    Parameters
    Type Name Description
    System.String text

    The text to clean.

    CleanStringType stringType

    A flag indicating the target casing and encoding of the string. By default, strings are cleaned up to camelCase and Ascii.

    Returns
    Type Description
    System.String

    The clean string.

    Remarks

    The string is cleaned in the context of the default culture.

    View Source

    CleanString(String, CleanStringType, Char)

    Cleans a string, using a specified separator.

    Declaration
    public string CleanString(string text, CleanStringType stringType, char separator)
    Parameters
    Type Name Description
    System.String text

    The text to clean.

    CleanStringType stringType

    A flag indicating the target casing and encoding of the string. By default, strings are cleaned up to camelCase and Ascii.

    System.Char separator

    The separator.

    Returns
    Type Description
    System.String

    The clean string.

    Remarks

    The string is cleaned in the context of the default culture.

    View Source

    CleanString(String, CleanStringType, Char, String)

    Cleans a string in the context of a specified culture, using a specified separator.

    Declaration
    public string CleanString(string text, CleanStringType stringType, char separator, string culture)
    Parameters
    Type Name Description
    System.String text

    The text to clean.

    CleanStringType stringType

    A flag indicating the target casing and encoding of the string. By default, strings are cleaned up to camelCase and Ascii.

    System.Char separator

    The separator.

    System.String culture

    The culture.

    Returns
    Type Description
    System.String

    The clean string.

    View Source

    CleanString(String, CleanStringType, String)

    Cleans a string in the context of a specified culture.

    Declaration
    public string CleanString(string text, CleanStringType stringType, string culture)
    Parameters
    Type Name Description
    System.String text

    The text to clean.

    CleanStringType stringType

    A flag indicating the target casing and encoding of the string. By default, strings are cleaned up to camelCase and Ascii.

    System.String culture

    The culture.

    Returns
    Type Description
    System.String

    The clean string.

    View Source

    CleanString(String, CleanStringType, String, Nullable<Char>)

    Declaration
    protected virtual string CleanString(string text, CleanStringType stringType, string culture, char? separator)
    Parameters
    Type Name Description
    System.String text
    CleanStringType stringType
    System.String culture
    System.Nullable<System.Char> separator
    Returns
    Type Description
    System.String
    View Source

    CleanStringForSafeAlias(String)

    Cleans a string to produce a string that can safely be used in an alias.

    Declaration
    public virtual string CleanStringForSafeAlias(string text)
    Parameters
    Type Name Description
    System.String text

    The text to filter.

    Returns
    Type Description
    System.String

    The safe alias.

    Remarks

    The string will be cleaned in the context of the default culture.

    Safe aliases are Ascii only.

    View Source

    CleanStringForSafeAlias(String, String)

    Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an alias.

    Declaration
    public virtual string CleanStringForSafeAlias(string text, string culture)
    Parameters
    Type Name Description
    System.String text

    The text to filter.

    System.String culture

    The culture.

    Returns
    Type Description
    System.String

    The safe alias.

    Remarks

    Safe aliases are Ascii only.

    View Source

    CleanStringForSafeFileName(String)

    Cleans a string, in the context of the default culture, to produce a string that can safely be used as a filename, both internally (on disk) and externally (as a URL).

    Declaration
    public virtual string CleanStringForSafeFileName(string text)
    Parameters
    Type Name Description
    System.String text

    The text to filter.

    Returns
    Type Description
    System.String

    The safe filename.

    Remarks

    Legacy says this was used to "overcome an issue when Umbraco is used in IE in an intranet environment" but that issue is not documented.

    View Source

    CleanStringForSafeFileName(String, String)

    Cleans a string to produce a string that can safely be used as a filename, both internally (on disk) and externally (as a URL).

    Declaration
    public virtual string CleanStringForSafeFileName(string text, string culture)
    Parameters
    Type Name Description
    System.String text

    The text to filter.

    System.String culture

    The culture.

    Returns
    Type Description
    System.String

    The safe filename.

    View Source

    CleanStringForUrlSegment(String)

    Cleans a string to produce a string that can safely be used in an URL segment.

    Declaration
    public virtual string CleanStringForUrlSegment(string text)
    Parameters
    Type Name Description
    System.String text

    The text to filter.

    Returns
    Type Description
    System.String

    The safe URL segment.

    Remarks

    The string will be cleaned in the context of the default culture.

    Url segments are Ascii only (no accents...).

    View Source

    CleanStringForUrlSegment(String, String)

    Cleans a string, in the context of a specified culture, to produce a string that can safely be used in an URL segment.

    Declaration
    public virtual string CleanStringForUrlSegment(string text, string culture)
    Parameters
    Type Name Description
    System.String text

    The text to filter.

    System.String culture

    The culture.

    Returns
    Type Description
    System.String

    The safe URL segment.

    Remarks

    Url segments are Ascii only (no accents...).

    View Source

    IsValidFileNameChar(Char)

    Declaration
    public static bool IsValidFileNameChar(char c)
    Parameters
    Type Name Description
    System.Char c
    Returns
    Type Description
    System.Boolean
    View Source

    SplitPascalCasing(String, Char)

    Splits a Pascal-cased string into a phrase separated by a separator.

    Declaration
    public virtual string SplitPascalCasing(string text, char separator)
    Parameters
    Type Name Description
    System.String text

    The text to split.

    System.Char separator

    The separator, which defaults to a whitespace.

    Returns
    Type Description
    System.String

    The split text.

    Remarks

    Supports Utf8 and Ascii strings, not Unicode strings.

    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • DefaultShortStringHelper(IOptions<RequestHandlerSettings>)
      • DefaultShortStringHelper(DefaultShortStringHelperConfig)
    • Methods
      • CleanString(String, CleanStringType)
      • CleanString(String, CleanStringType, Char)
      • CleanString(String, CleanStringType, Char, String)
      • CleanString(String, CleanStringType, String)
      • CleanString(String, CleanStringType, String, Nullable<Char>)
      • CleanStringForSafeAlias(String)
      • CleanStringForSafeAlias(String, String)
      • CleanStringForSafeFileName(String)
      • CleanStringForSafeFileName(String, String)
      • CleanStringForUrlSegment(String)
      • CleanStringForUrlSegment(String, String)
      • IsValidFileNameChar(Char)
      • SplitPascalCasing(String, Char)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX