Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Helper.php

function Helper::substr

Returns the subset of a string, using mb_substr if it is available.

4 calls to Helper::substr()
Application::find in vendor/symfony/console/Application.php
Finds a command by name or alias.
FormatterHelper::truncate in vendor/symfony/console/Helper/FormatterHelper.php
Truncates a message to the given length.
QuestionHelper::autocomplete in vendor/symfony/console/Helper/QuestionHelper.php
Autocompletes a question.
Table::renderRowSeparator in vendor/symfony/console/Helper/Table.php
Renders horizontal header separator.

File

vendor/symfony/console/Helper/Helper.php, line 77

Class

Helper
Helper is the base class for all helper classes.

Namespace

Symfony\Component\Console\Helper

Code

public static function substr(?string $string, int $from, ?int $length = null) : string {
    $string ??= '';
    if (false === ($encoding = mb_detect_encoding($string, null, true))) {
        return substr($string, $from, $length);
    }
    return mb_substr($string, $from, $length, $encoding);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal