[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/string/src/phputf8/native/ -> core.php (summary)

(no description)

File Size: 430 lines (17 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 6 functions

  utf8_strlen()
  utf8_strpos()
  utf8_strrpos()
  utf8_substr()
  utf8_strtolower()
  utf8_strtoupper()

Functions
Functions that are not part of a class:

utf8_strlen($str)   X-Ref
Unicode aware replacement for strlen(). Returns the number
of characters in the string (not the number of bytes), replacing
multibyte characters with a single byte equivalent
utf8_decode() converts characters that are not in ISO-8859-1
to '?', which, for the purpose of counting, is alright - It's
much faster than iconv_strlen
Note: this function does not count bad UTF-8 bytes in the string
- these are simply ignored

author: <chernyshevsky at hotmail dot com>
param: string UTF-8 string
return: int number of UTF-8 characters in string

utf8_strpos($str, $needle, $offset = NULL)   X-Ref
UTF-8 aware alternative to strpos
Find position of first occurrence of a string
Note: This will get alot slower if offset is used
Note: requires utf8_strlen amd utf8_substr to be loaded

param: string haystack
param: string needle (you should validate this with utf8_is_valid)
param: integer offset in characters (from left)
return: mixed integer position or FALSE on failure

utf8_strrpos($str, $needle, $offset = NULL)   X-Ref
UTF-8 aware alternative to strrpos
Find position of last occurrence of a char in a string
Note: This will get alot slower if offset is used
Note: requires utf8_substr and utf8_strlen to be loaded

param: string haystack
param: string needle (you should validate this with utf8_is_valid)
param: integer (optional) offset (from left)
return: mixed integer position or FALSE on failure

utf8_substr($str, $offset, $length = NULL)   X-Ref
UTF-8 aware alternative to substr
Return part of a string given character offset (and optionally length)

Note arguments: comparied to substr - if offset or length are
not integers, this version will not complain but rather massages them
into an integer.

Note on returned values: substr documentation states false can be
returned in some cases (e.g. offset > string length)
mb_substr never returns false, it will return an empty string instead.
This adopts the mb_substr approach

Note on implementation: PCRE only supports repetitions of less than
65536, in order to accept up to MAXINT values for offset and length,
we'll repeat a group of 65535 characters when needed.

Note on implementation: calculating the number of characters in the
string is a relatively expensive operation, so we only carry it out when
necessary. It isn't necessary for +ve offsets and no specified length

author: Chris Smith<[email protected]>
param: string
param: integer number of UTF-8 characters offset (from left)
param: integer (optional) length in UTF-8 characters from offset
return: mixed string or FALSE if failure

utf8_strtolower($string)   X-Ref
UTF-8 aware alternative to strtolower
Make a string lowercase
Note: The concept of a characters "case" only exists is some alphabets
such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does
not exist in the Chinese alphabet, for example. See Unicode Standard
Annex #21: Case Mappings
Note: requires utf8_to_unicode and utf8_from_unicode

author: Andreas Gohr <[email protected]>
param: string
return: mixed either string in lowercase or FALSE is UTF-8 invalid

utf8_strtoupper($string)   X-Ref
UTF-8 aware alternative to strtoupper
Make a string uppercase
Note: The concept of a characters "case" only exists is some alphabets
such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does
not exist in the Chinese alphabet, for example. See Unicode Standard
Annex #21: Case Mappings
Note: requires utf8_to_unicode and utf8_from_unicode

author: Andreas Gohr <[email protected]>
param: string
return: mixed either string in lowercase or FALSE is UTF-8 invalid



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer