From b737121adfba187fb6db52eb595bb3236c8a9a84 Mon Sep 17 00:00:00 2001 From: Ed Batutis Date: Thu, 8 May 2008 13:43:56 +0000 Subject: [PATCH] collapse extract variants into one function git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@259329 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/intl/functions/grapheme-extract.xml | 28 +++- .../intl/functions/grapheme-extractb.xml | 127 ------------------ 2 files changed, 23 insertions(+), 132 deletions(-) delete mode 100644 reference/intl/functions/grapheme-extractb.xml diff --git a/reference/intl/functions/grapheme-extract.xml b/reference/intl/functions/grapheme-extract.xml index f2f9fb8e42..7e53d2d138 100644 --- a/reference/intl/functions/grapheme-extract.xml +++ b/reference/intl/functions/grapheme-extract.xml @@ -1,5 +1,5 @@ - + grapheme_extract @@ -35,10 +35,28 @@ size - Maximum number of grapheme clusters to return. + Maximum number items - based on the $extract_type - to return. + + extract_type + + + Defines the type of units referred to by the $size parameter: + + + + GRAPHEME_EXTR_COUNT (default) - $size is the number of default + grapheme clusters to extract. + GRAPHEME_EXTR_MAXBYTES - $size is the maximum number of bytes + returned. + GRAPHEME_EXTR_MAXCHARS - $size is the maximum number of UTF-8 + characters returned. + + + + start @@ -58,7 +76,8 @@ &reftitle.returnvalues; - A string starting at offset $start containing no more than $size grapheme clusters and ending on a default grapheme cluster boundary. + A string starting at offset $start and ending on a default grapheme cluster + boundary that conforms to the $size and $extract_type specified. @@ -73,7 +92,7 @@ $char_a_ring_nfd = "a\xCC\x8A"; // 'LATIN SMALL LETTER A WITH RING ABOVE' (U+00E5) normalization form "D" $char_o_diaeresis_nfd = "o\xCC\x88"; // 'LATIN SMALL LETTER O WITH DIAERESIS' (U+00F6) normalization form "D" -print urlencode(grapheme_extract( $char_a_ring_nfd . $char_o_diaeresis_nfd, 1, 2)); +print urlencode(grapheme_extract( $char_a_ring_nfd . $char_o_diaeresis_nfd, 1, GRAPHEME_EXTR_COUNT, 2)); ?> ]]> @@ -91,7 +110,6 @@ o%CC%88 &reftitle.seealso; - grapheme_extractb grapheme_substr diff --git a/reference/intl/functions/grapheme-extractb.xml b/reference/intl/functions/grapheme-extractb.xml deleted file mode 100644 index 4957991453..0000000000 --- a/reference/intl/functions/grapheme-extractb.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - grapheme_extractb - Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8. - - - &reftitle.description; - Procedural style - - stringgrapheme_extractb - stringhaystack - intbsize - intstart - - - Function to extract a sequence of default grapheme clusters from a text - buffer, which must be encoded in UTF-8, limited by a byte count. - - - - - &reftitle.parameters; - - - - haystack - - - String to search. - - - - - bsize - - - Maximum number of bytes to return. - - - - - start - - - Starting position in $haystack in bytes. If given, it must be zero or a - positive value that is less than or equal to the length of $haystack in - bytes. The default is zero. If $start does not point to the first byte of a - UTF-8 character, the start position is moved to the next character - boundary. - - - - - - - - - - &reftitle.returnvalues; - - A string starting at offset $start containing no more than $bsize bytes and ending on a default grapheme cluster boundary. - - - - - &reftitle.examples; - - <function>grapheme_extractb</function> example - - -]]> - - - &example.outputs; - - - - - - - &reftitle.seealso; - - - grapheme_extract - grapheme_substr - - - Unicode Text Segmentation: Grapheme Cluster Boundaries - - - - - - - -