Skip to content

Pluralize templating breaks when string includes an apostrophe #23

@AnthonyP4312

Description

@AnthonyP4312

I've been using Humanizer in a kotlin project recently and was trying to use the pluralize method however I ran into an interesting bug.

val result = Humanize.pluralize(
        "string with a single thing",
        "string with {1} things",
        "string with no things",
        3,
        "three"
)

println(result)
// => "string with three things"

This usage properly works and will template the value three into the many parameter.
However, if I add an apostrophe somewhere in the string, the templating no longer works,
and the apostrophe is removed.

val result = Humanize.pluralize(
        "string with a single thing",
        "can't use string with {1} things",
        "string with no things",
        3,
        "three"
)

println(result)
// => "cant use string with {1} things"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions