summaryrefslogtreecommitdiff
path: root/ext/intl/doc/grapheme_api.php
blob: 75ad7a04b5861ab85df5e61354837c598bd73b7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
#############################################################################
# Grapheme constants.
#############################################################################

	/**
	 * grapheme_extract extract_type
	 *
	*/
	/** Extract the given number of whole grapheme clusters from the string: */
	define('GRAPHEME_EXTR_COUNT', 0);
	/** Extract as many whole grapheme clusters as will fit into the given number of bytes: */
	define('GRAPHEME_EXTR_MAXBYTES', 1);
	/** Extract whole grapheme clusters up to a maximum number of UTF-8 characters: */
	define('GRAPHEME_EXTR_MAXCHARS', 2);


#############################################################################
# Grapheme API
#############################################################################

	/**
	 * Get string length in grapheme units
	 * @param  string	$input		The string being measured for length.
	 * @return int		The length of the string on success, and 0 if the string is empty.
	*/
	function grapheme_strlen($input) {}

	/**
	 * Find position (in grapheme units) of first occurrence of a string
	 * @param string	$haystack	The string to look in
	 * @param string	$needle		The string to look for
	 * @param [int]		$offset		The optional offset parameter allows you to specify
						which character in haystack  to start searching. The position
						returned is still relative to the beginning of haystack.
	 * @return int		Returns the position as an integer. If needle is not found, strpos() will return boolean FALSE.
	*/
	function grapheme_strpos($haystack, $needle, $offset = 0) {}


	/**
         * Find position (in grapheme units) of first occurrence of a case-insensitive string
         * @param string        $haystack       The string to look in
         * @param string        $needle         The string to look for
         * @param [int]         $offset         The optional offset parameter allows you to specify
                                                which character in haystack  to start searching. The position
                                                returned is still relative to the beginning of haystack.
         * @return int          Returns the position as an integer. If needle is not found, grapheme_stripos() will return boolean FALSE.
        */
        function grapheme_stripos($haystack, $needle, $offset = 0) {}


	/**
         * Find position (in grapheme units) of last occurrence of a string
         * @param string        $haystack       The string to look in
         * @param string        $needle         The string to look for
         * @param [int]         $offset         The optional offset parameter allows you to specify
                                                which character in haystack  to start searching. The position
                                                returned is still relative to the beginning of haystack.
         * @return int          Returns the position as an integer. If needle is not found, grapheme_strrpos() will return boolean FALSE.
        */
        function grapheme_strrpos($haystack, $needle, $offset = 0) {}


	/**
         * Find position (in grapheme units) of last occurrence of a case-insensitive string
         * @param string        $haystack       The string to look in
         * @param string        $needle         The string to look for
         * @param [int]         $offset         The optional offset parameter allows you to specify
                                                which character in haystack  to start searching. The position
                                                returned is still relative to the beginning of haystack.
         * @return int          Returns the position as an integer. If needle is not found, grapheme_strripos() will return boolean FALSE.
        */
        function grapheme_strripos($haystack, $needle, $offset = 0) {}


	/**
	 * Return part of a string
	 * @param string	$string		The input string.
	 * @param int		$start		If start  is non-negative, the returned string will start at the
						start'th position in string, counting from zero. If start is negative,
						the returned string will start at the start'th character from the
						end of string.
	 * @param [int]		$length		If length  is given and is positive, the string returned will contain
						at most length characters beginning from start (depending on the
						length of string). If string is less than or equal to start characters
						long, FALSE  will be returned. If length is given and is negative, then
						that many characters will be omitted from the end of string (after the
						start position has been calculated when a start is negative). If start
						denotes a position beyond this truncation, an empty string will be returned.
	 * @return int		Returns the extracted part of string.
	*/
	function grapheme_substr($string, $start, $length = -1) {}


	/**
	 * Returns part of haystack string from the first occurrence of needle to the end of haystack.
	 * @param string	$haystack	The input string.
	 * @param string	$needle		The string to look for.
	 * @param [boolean]	$before_needle	If TRUE (the default is FALSE), grapheme_strstr() returns the part of the
						haystack before the first occurrence of the needle.
	 * @return string	Returns the portion of string, or FALSE if needle is not found.
	*/
	function grapheme_strstr($haystack, $needle, $before_needle = FALSE) {}


	/**
	 * Returns part of haystack string from the first occurrence of case-insensitive needle to the end of haystack.
         * @param string        $haystack       The input string.
         * @param string        $needle         The string to look for.
         * @param [boolean]     $before_needle  If TRUE (the default is FALSE), grapheme_strstr() returns the part of the
                                                haystack before the first occurrence of the needle.
         * @return string       Returns the portion of string, or FALSE if needle is not found.
        */
        function grapheme_stristr($haystack, $needle, $before_needle = FALSE) {}


	/**
	 * Function to extract a sequence of default grapheme clusters from a text buffer, which must be encoded in UTF-8.
	 * @param string 	$haystack	string to search
	 * @param int		$size		maximum number of units - based on the $extract_type - to return
	 * @param [int]		$extract_type	one of GRAPHEME_EXTR_COUNT (default), GRAPHEME_EXTR_MAXBYTES, or GRAPHEME_EXTR_MAXCHARS
	 * @param [int]		$start		starting position in $haystack in bytes
	 * @param [&int]	$next		set to next starting position in bytes
	 * @return string	A string starting at offset $start containing no more than $size grapheme clusters
				and ending on a default grapheme cluster boundary.
	*/
	function grapheme_extract($haystack, $size, $extract_type = GRAPHEME_EXTR_COUNT, $start = 0, &$next) {}

?>