C# Class Pdoxcl2Sharp.InflectorExtensions

Inflector extensions
显示文件 Open project: nickbabcock/Pdoxcl2Sharp

Public Methods

Method Description
Camelize ( this input ) : string

Same as Pascalize except that the first character is lower case

Dasherize ( this underscoredWord ) : string

Replaces underscores with dashes in the string

Hyphenate ( this underscoredWord ) : string

Replaces underscores with hyphens in the string

Pascalize ( this input ) : string

By default, pascalize converts strings to UpperCamelCase also removing underscores

Pluralize ( this word, Plurality plurality = Plurality.Singular ) : string

Pluralizes the provided input considering irregular words

Singularize ( this word, Plurality plurality = Plurality.Plural ) : string

Singularizes the provided input considering irregular words

Underscore ( this input ) : string

Separates the input words with underscore

Private Methods

Method Description
AddIrregular ( string singular, string plural ) : void
AddPlural ( string rule, string replacement ) : void
AddSingular ( string rule, string replacement ) : void
AddUncountable ( string word ) : void
ApplyRules ( List rules, string word ) : string
InflectorExtensions ( ) : System.Collections.Generic

Method Details

Camelize() public static method

Same as Pascalize except that the first character is lower case
public static Camelize ( this input ) : string
input this
return string

Dasherize() public static method

Replaces underscores with dashes in the string
public static Dasherize ( this underscoredWord ) : string
underscoredWord this
return string

Hyphenate() public static method

Replaces underscores with hyphens in the string
public static Hyphenate ( this underscoredWord ) : string
underscoredWord this
return string

Pascalize() public static method

By default, pascalize converts strings to UpperCamelCase also removing underscores
public static Pascalize ( this input ) : string
input this
return string

Pluralize() public static method

Pluralizes the provided input considering irregular words
public static Pluralize ( this word, Plurality plurality = Plurality.Singular ) : string
word this Word to be pluralized
plurality Plurality Normally you call Pluralize on singular words; but if you're unsure call it with Plurality.CouldBeEither
return string

Singularize() public static method

Singularizes the provided input considering irregular words
public static Singularize ( this word, Plurality plurality = Plurality.Plural ) : string
word this Word to be singularized
plurality Plurality Normally you call Singularize on plural words; but if you're unsure call it with Plurality.CouldBeEither
return string

Underscore() public static method

Separates the input words with underscore
public static Underscore ( this input ) : string
input this The string to be underscored
return string