Skip to content

[String] Slugify a string with an apostropheΒ #34822

@wanted80

Description

@wanted80

Using the String component (love it btw) v5.0.1 and the AsciiSlugger class to slugify a string, I noticed that apostrophes are not removed but they are replaced with the default dash separator.

Example:

(new AsciiSlugger())->slug("I'll see") result is I-ll-see instead of ill-see

I temporarily fixed adding a replace in my custom slugify method that extend the UnicodeString class:

public function slugify(): self
{
    $str = clone $this->folded()->replace('\'', '');

    $str->string = (string) (new AsciiSlugger())->slug($str->string);

    return $str;
}

Will it be possible to replace apostrophes by default in future release? Thanks :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions