unicode_requirements

unicode_requirements() Returns Unicode library status and errors. File core/includes/unicode.inc, line 13 Provides Unicode-related conversions and operations. Code function unicode_requirements() { $libraries = array( Unicode::STATUS_SINGLEBYTE => t('Standard PHP'), Unicode::STATUS_MULTIBYTE => t('PHP Mbstring Extension'), Unicode::STATUS_ERROR => t('Error'), ); $severities = array( Unicode::STATUS_SINGLEBYTE => REQUIREMENT_WARNING, Unicode::STATUS_MULTIB

Unicode::validateUtf8

public static Unicode::validateUtf8($text) Checks whether a string is valid UTF-8. All functions designed to filter input should use drupal_validate_utf8 to ensure they operate on valid UTF-8 strings to prevent bypass of the filter. When text containing an invalid UTF-8 lead byte (0xC0 - 0xFF) is presented as UTF-8 to Internet Explorer 6, the program may misinterpret subsequent bytes. When these subsequent bytes are HTML control characters such as quotes or angle brackets, parts of the text tha

Unicode::ucwords

public static Unicode::ucwords($text) Capitalizes the first character of each word in a UTF-8 string. Parameters string $text: The text that will be converted. Return value string The input $text with each word capitalized. Related topics PHP wrapper functions Functions that are wrappers or custom implementations of PHP functions. File core/lib/Drupal/Component/Utility/Unicode.php, line 377 Class Unicode Provides Unicode-related conversions and operations. Namespace Drupal\Component

Unicode::ucfirst

public static Unicode::ucfirst($text) Capitalizes the first character of a UTF-8 string. Parameters string $text: The string to convert. Return value string The string with the first character as uppercase. File core/lib/Drupal/Component/Utility/Unicode.php, line 346 Class Unicode Provides Unicode-related conversions and operations. Namespace Drupal\Component\Utility Code public static function ucfirst($text) { return static::strtoupper(static::substr($text, 0, 1)) . static::substr

Unicode::truncateBytes

public static Unicode::truncateBytes($string, $len) Truncates a UTF-8-encoded string safely to a number of bytes. If the end position is in the middle of a UTF-8 sequence, it scans backwards until the beginning of the byte sequence. Use this function whenever you want to chop off a string at an unsure location. On the other hand, if you're sure that you're splitting on a character boundary (e.g. after using strpos() or similar), you can safely use substr() instead. Parameters string $string: T

Unicode::truncate

public static Unicode::truncate($string, $max_length, $wordsafe = FALSE, $add_ellipsis = FALSE, $min_wordsafe_length = 1) Truncates a UTF-8-encoded string safely to a number of characters. Parameters string $string: The string to truncate. int $max_length: An upper limit on the returned string length, including trailing ellipsis if $add_ellipsis is TRUE. bool $wordsafe: If TRUE, attempt to truncate on a word boundary. Word boundaries are spaces, punctuation, and Unicode characters used as word

Unicode::substr

public static Unicode::substr($text, $start, $length = NULL) Cuts off a piece of a string based on character indices and counts. Follows the same behavior as PHP's own substr() function. Note that for cutting off a string at a known character/substring location, the usage of PHP's normal strpos/substr is safe and much faster. Parameters string $text: The input string. int $start: The position at which to start reading. int $length: The number of characters to read. Return value string The sho

Unicode::strtoupper

public static Unicode::strtoupper($text) Converts a UTF-8 string to uppercase. Parameters string $text: The string to run the operation on. Return value string The string in uppercase. File core/lib/Drupal/Component/Utility/Unicode.php, line 302 Class Unicode Provides Unicode-related conversions and operations. Namespace Drupal\Component\Utility Code public static function strtoupper($text) { if (static::getStatus() == static::STATUS_MULTIBYTE) { return mb_strtoupper($text);

Unicode::strtolower

public static Unicode::strtolower($text) Converts a UTF-8 string to lowercase. Parameters string $text: The string to run the operation on. Return value string The string in lowercase. File core/lib/Drupal/Component/Utility/Unicode.php, line 324 Class Unicode Provides Unicode-related conversions and operations. Namespace Drupal\Component\Utility Code public static function strtolower($text) { if (static::getStatus() == static::STATUS_MULTIBYTE) { return mb_strtolower($text);

Unicode::strpos

public static Unicode::strpos($haystack, $needle, $offset = 0) Finds the position of the first occurrence of a string in another string. Parameters string $haystack: The string to search in. string $needle: The string to find in $haystack. int $offset: If specified, start the search at this number of characters from the beginning (default 0). Return value int|false The position where $needle occurs in $haystack, always relative to the beginning (independent of $offset), or FALSE if not found.