Skip to content

Add grapheme_mask() function Grapheme mask#22614

Open
sepehrphpr wants to merge 35 commits into
php:masterfrom
sepehrphpr:grapheme-mask
Open

Add grapheme_mask() function Grapheme mask#22614
sepehrphpr wants to merge 35 commits into
php:masterfrom
sepehrphpr:grapheme-mask

Conversation

@sepehrphpr

Copy link
Copy Markdown

This PR implements the grapheme_mask() function as proposed in the RFC:

https://wiki.php.net/rfc/grapheme_mask

The function works similarly to str_mask() but operates on grapheme cluster

boundaries instead of bytes/code points, making it fully Unicode-safe.

It uses ICU BreakIterator for grapheme boundary detection, consistent with

other grapheme_*() functions in ext/intl.

Changes:

Added grapheme_mask.c and grapheme_mask.h (Modified BSD license)
Implemented grapheme_mask() using ICU BreakIterator
Added grapheme_mask() declaration to grapheme.stub.php
Generated grapheme_arginfo.h
Added grapheme_mask.phpt test case

@youkidearitai youkidearitai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not change file structure. Your RFC is not include it.

Please only add about intl/grapheme/grapheme.cpp, intl/php_intl.stub.php and *.phpt files. Probably enough them files that this RFC.

@youkidearitai

Copy link
Copy Markdown
Contributor

And, Please close #22605 if you continue this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants