drupal_strlen

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 drupal_strlen($text)

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

▾ 9 functions call drupal_strlen()

node_teaser in modules/node/node.module
Generate a teaser for a node body.
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).
search_index in modules/search/search.module
Update the full-text search index for a particular item.
theme_username in includes/theme.inc
Format a username.
truncate_utf8 in includes/unicode.inc
Truncate a UTF-8-encoded string safely to a number of characters.
user_validate_name in modules/user/user.module
Verify the syntax of the given name.
_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.
_process_comment in includes/common.inc
Process comment blocks.
_search_parse_query in modules/search/search.module
Helper function for search_parse_query();

Code

includes/unicode.inc, line 407

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

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen