function drupal_strlen

7 drupal_strlen($text)

Count the amount of characters in a UTF-8 string. This is less than or equal to the byte count.

Related topics

20 calls to drupal_strlen()
DrupalHtmlToTextTestCase::testVeryLongLineWrap in modules/simpletest/tests/mail.test
Tests that drupal_html_to_text() wraps before 1000 characters.
drupal_html_to_text in includes/
Transforms an HTML string into plain text, preserving its structure.
field_create_field in modules/field/
Creates a field.
hook_field_validate in modules/field/field.api.php
Validate this module's field data.
list_allowed_values_setting_validate in modules/field/modules/list/list.module
Element validate callback; check that the entered values are valid.

... See full list


includes/, line 438


function drupal_strlen($text) {
  global $multibyte;
  if ($multibyte == UNICODE_MULTIBYTE) {
    return mb_strlen($text);
  else {
    // Do not count UTF-8 continuation bytes.
    return strlen(preg_replace("/[\x80-\xBF]/", '', $text));