function drupal_strlen
7.x unicode.inc | drupal_strlen($text) |
6.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.
9 calls to drupal_strlen()
- node_teaser in drupal-6.x/
modules/ node/ node.module - Generate a teaser for a node body.
- search_expand_cjk in drupal-6.x/
modules/ search/ search.module - Basic CJK tokenizer. Simply splits a string into consecutive, overlapping sequences of characters ('minimum_word_size' long).
- search_index in drupal-6.x/
modules/ search/ search.module - Update the full-text search index for a particular item.
- theme_username in drupal-6.x/
includes/ theme.inc - Format a username.
- truncate_utf8 in drupal-6.x/
includes/ unicode.inc - Truncate a UTF-8-encoded string safely to a number of characters.
File
- drupal-6.x/
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("/[\x80-\xBF]/", '', $text));
}
}