Skip to content

"S".Pluralize(false) throws an IndexOutOfRangeException #1541

@joostverhoog

Description

@joostverhoog

I expected the output of "S".Pluralize(false) to be "Ss", because I see "s" appended for other letters. e.g. "K".Pluralize(false) == "Ks"

However, it throws an exception:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.String.get_Chars(Int32 index)
at Humanizer.Inflections.Vocabulary.MatchUpperCase(String word, String replacement) in //src/Humanizer/Inflections/Vocabulary.cs:line 158
at Humanizer.Inflections.Vocabulary.ApplyRules(IList`1 rules, String word, Boolean skipFirstRule) in /
/src/Humanizer/Inflections/Vocabulary.cs:line 148
at Humanizer.Inflections.Vocabulary.Pluralize(String word, Boolean inputIsKnownToBeSingular) in //src/Humanizer/Inflections/Vocabulary.cs:line 85
at Humanizer.InflectorExtensions.Pluralize(String word, Boolean inputIsKnownToBeSingular) in /
/src/Humanizer/InflectorExtensions.cs:line 42

Found in Humanizer.Core 2.14.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions