function drupal_substr

Cuts off a piece of a string based on character indices and counts.

Parameters

$text: The input string.

$start: The position at which to start reading.

$length: The number of characters to read.

Return value

The shortened string.

See also

\Drupal\Component\Utility\Unicode::substr().

Related topics

21 calls to drupal_substr()
DbLogTest::doUser in drupal/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php
Generates and then verifies some user events.
DisplayPluginBase::optionsSummary in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Provide the default summary for options in the views UI.
DrupalDiffInline::process_chunk in drupal/core/lib/Drupal/Component/Diff/DiffEngine.php
Merge chunk segments between tag delimiters.
DrupalDiffInline::render in drupal/core/lib/Drupal/Component/Diff/DiffEngine.php
Render differences inline using HTML markup.
FieldPluginBase::renderText in drupal/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
Perform an advanced text render for the item.

... See full list

File

drupal/core/includes/unicode.inc, line 324
Provides Unicode-related conversions and operations.

Code

function drupal_substr($text, $start, $length = NULL) {
  return Unicode::substr($text, $start, $length);
}