[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Source view] [Print] [Project Stats]
Locate a byte index given a UTF-8 character index
File Size: | 168 lines (5 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
utf8_byte_position() X-Ref |
Given a string and a character index in the string, in terms of the UTF-8 character position, returns the byte index of that character. Can be useful when you want to PHP's native string functions but we warned, locating the byte can be expensive Takes variable number of parameters - first must be the search string then 1 to n UTF-8 character positions to obtain byte indexes for - it is more efficient to search the string for multiple characters at once, than make repeated calls to this function author: Chris Smith<[email protected]> param: string string to locate index in param: int (n times) return: mixed - int if only one input int, array if more return: boolean TRUE if it's all ASCII |
utf8_locate_current_chr( &$str, $idx ) X-Ref |
Given a string and any byte index, returns the byte index of the start of the current UTF-8 character, relative to supplied position. If the current character begins at the same place as the supplied byte index, that byte index will be returned. Otherwise this function will step backwards, looking for the index where current UTF-8 character begins author: Chris Smith<[email protected]> param: string param: int byte index in the string return: int byte index of start of next UTF-8 character |
utf8_locate_next_chr( &$str, $idx ) X-Ref |
Given a string and any byte index, returns the byte index of the start of the next UTF-8 character, relative to supplied position. If the next character begins at the same place as the supplied byte index, that byte index will be returned. author: Chris Smith<[email protected]> param: string param: int byte index in the string return: int byte index of start of next UTF-8 character |
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |