Same name and namespace in other branches
  1. 5.x includes/unicode.inc \drupal_strlen()
  2. 6.x includes/unicode.inc \drupal_strlen()
  3. 7.x includes/unicode.inc \drupal_strlen()

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

1 call to drupal_strlen()
search_expand_cjk in modules/search.module
Basic CJK tokenizer. Simply splits a string into consecutive, overlapping sequences of characters ('minimum_word_size' long).

File

includes/unicode.inc, line 346

Code

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("", '', $text));
  }
}