Skip to content

[String] Add a method to strip emojis from strings #48850

Closed as not planned
Closed as not planned
@javiereguiluz

Description

@javiereguiluz

Description

In #48396 we added an option to remove emojis from slugs:

use Symfony\Component\String\Slugger\AsciiSlugger;

$slugger = new AsciiSlugger();
$slugger = $slugger->withEmoji('strip');

$slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁');

I'd like to have this feature for strings too, not only slugs.

Example

use function Symfony\Component\String\u;

$string = u('😺 Lorem ipsum 🐈‍⬛ dolor sit amet 🦁')->stripEmojis()->toString();
// $string = ' Lorem ipsum  dolor sit amet '

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions