C# Class Sitecore.SharedSource.Commons.Utilities.ItemNameUtil

Utilities for dealing with item names
显示文件 Open project: Velir/Sitecore-Commons

Public Methods

Method Description
CleanNameOfExtraSpaces ( string nameText ) : string

Cleans the name of extra spaces both internally and at the beginning and end of the name.

CleanNameOfHtml ( string nameText ) : string

Cleans a name of HTML tags.

CleanNameOfText ( string nameText, List textToStrip ) : string

Cleans the name of a list of strings.

CleanNameOfText ( string nameText, string regularExpression ) : string

Replace any text matching the passed in regular expression with a blank string.

GetForeignCharacterMap ( ) : Hashtable

Returns a Hashtable with the foreign character to english character mappings.

GetValidItemName ( string nameText ) : string

Gets the name of the valid.

GetValidItemName ( string nameText, bool stripTags, bool replaceForeignCharacters ) : string

Returns a valid item name for the passed in text

ReplaceCharacters ( string nameText, Hashtable characterMap ) : string

Takes the passed in characters (the keys in the Hashtable) and replaces them with the Hashtable key value.

ReplaceForeignCharacters ( string nameText ) : string

Replaces the foreign characters in a name with their english equivalents.

Method Details

CleanNameOfExtraSpaces() public static method

Cleans the name of extra spaces both internally and at the beginning and end of the name.
public static CleanNameOfExtraSpaces ( string nameText ) : string
nameText string The name text.
return string

CleanNameOfHtml() public static method

Cleans a name of HTML tags.
public static CleanNameOfHtml ( string nameText ) : string
nameText string The name text.
return string

CleanNameOfText() public static method

Cleans the name of a list of strings.
public static CleanNameOfText ( string nameText, List textToStrip ) : string
nameText string The name text to strip text from.
textToStrip List The text to strip.
return string

CleanNameOfText() public static method

Replace any text matching the passed in regular expression with a blank string.
public static CleanNameOfText ( string nameText, string regularExpression ) : string
nameText string The name text.
regularExpression string The regular expression.
return string

GetForeignCharacterMap() public static method

Returns a Hashtable with the foreign character to english character mappings.
public static GetForeignCharacterMap ( ) : Hashtable
return System.Collections.Hashtable

GetValidItemName() public static method

Gets the name of the valid.
public static GetValidItemName ( string nameText ) : string
nameText string The name text.
return string

GetValidItemName() public static method

Returns a valid item name for the passed in text
public static GetValidItemName ( string nameText, bool stripTags, bool replaceForeignCharacters ) : string
nameText string The name text.
stripTags bool if set to true [strip tags].
replaceForeignCharacters bool if set to true [replace foreign characters].
return string

ReplaceCharacters() public static method

Takes the passed in characters (the keys in the Hashtable) and replaces them with the Hashtable key value.
public static ReplaceCharacters ( string nameText, Hashtable characterMap ) : string
nameText string The name text.
characterMap System.Collections.Hashtable The character map.
return string

ReplaceForeignCharacters() public static method

Replaces the foreign characters in a name with their english equivalents.
public static ReplaceForeignCharacters ( string nameText ) : string
nameText string The name text.
return string