4.7.x unicode.inc drupal_strlen($text)
5.x unicode.inc drupal_strlen($text)
6.x unicode.inc drupal_strlen($text)
7.x unicode.inc drupal_strlen($text)

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

2 calls to drupal_strlen()
search_expand_cjk in modules/search/search.module
Basic CJK tokenizer. Simply splits a string into consecutive, overlapping sequences of characters ('minimum_word_size' long).
_form_validate in includes/form.inc
Performs validation on form elements. First ensures required fields are completed, #maxlength is not exceeded, and selected options were in the list of options given to the user. Then calls user-defined validators.

File

includes/unicode.inc, line 406

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));
  }
}