Class DefaultShortStringHelperConfig
Provides configuration for the DefaultShortStringHelper.
Inheritance
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 SourceDefaultShortStringHelperConfig()
Declaration
public DefaultShortStringHelperConfig()
Properties
View SourceDefaultCulture
Gets or sets the default culture to use for string operations.
Declaration
public string DefaultCulture { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
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 SourceApplyUrlReplaceCharacters(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. |
Clone()
Creates a deep copy of this configuration.
Declaration
public DefaultShortStringHelperConfig Clone()
Returns
| Type | Description |
|---|---|
| DefaultShortStringHelperConfig | A new DefaultShortStringHelperConfig instance with the same settings. |
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 |
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 |
| 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 |
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. |
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. |
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. |