drupal_strlen

  1. drupal
    1. 5
    2. 6
    3. 7
    4. 8
Versions
5 – 8 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

▾ 28 functions call 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/mail.inc
Transform an HTML string into plain text, preserving the structure of the markup. Useful for preparing the body of a node to be sent by e-mail.
field_create_field in modules/field/field.crud.inc
Creates a field.
field_ui_existing_field_options in modules/field_ui/field_ui.admin.inc
Return an array of existing field to be added to a bundle.
FileExampleSessionStreamWrapper::stream_read in examples/file_example/file_example_session_streams.inc
Support for fread(), file_get_contents() etc.
FileExampleSessionStreamWrapper::stream_seek in examples/file_example/file_example_session_streams.inc
Support for fseek().
FileExampleSessionStreamWrapper::stream_stat in examples/file_example/file_example_session_streams.inc
Support for fstat().
FileExampleSessionStreamWrapper::stream_write in examples/file_example/file_example_session_streams.inc
Support for fwrite(), file_put_contents() etc.
FileExampleSessionStreamWrapper::uri_to_session_key in examples/file_example/file_example_session_streams.inc
Return a reference to the correct $_SESSION key.
FileExampleSessionStreamWrapper::url_stat in examples/file_example/file_example_session_streams.inc
Support for stat().
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.
MenuTestCase::addCustomMenu in modules/menu/menu.test
Add custom menu.
menu_contextual_links in includes/menu.inc
Retrieve contextual links for a system object based on registered local tasks.
SearchQuery::parseWord in modules/search/search.extender.inc
Helper function for parseQuery().
SearchSimplifyTestCase::testSearchSimplifyUnicode in modules/search/search.test
Tests that all Unicode characters simplify correctly.
search_excerpt in modules/search/search.module
Returns snippets from a piece of text, with certain keywords highlighted. Used for formatting search results.
search_expand_cjk in modules/search/search.module
Splits CJK (Chinese, Japanese, Korean) text into tokens.
search_index in modules/search/search.module
Update the full-text search index for a particular item.
template_preprocess_username in includes/theme.inc
Preprocesses variables for theme_username().
text_field_validate in modules/field/modules/text/text.module
Implements hook_field_validate().
text_summary in modules/field/modules/text/text.module
Generate a trimmed, formatted version of a text field value.
theme_image_formatter in modules/image/image.field.inc
Returns HTML for an image field formatter.
truncate_utf8 in includes/unicode.inc
Truncates a UTF-8-encoded string safely to a number of characters.
UnicodeUnitTest::helperTestStrLen in modules/simpletest/tests/unicode.test
user_account_form_validate in modules/user/user.module
Form validation handler for user_account_form().
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.

Code

includes/unicode.inc, line 438

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