You are here

protected static function SearchApiDbService::mbStrcut in Search API Database Search 7

Emulates self::mbStrcut() if that is not available.

Though the Mbstring PHP extension is recommended for running Drupal, it is not required. Therefore, we have to wrap calls to its functions.

Parameters

string $str: The string being cut.

int $start: Starting position in bytes.

int|null $length: (optional) Length in bytes. If NULL is passed, extract all bytes to the end of the string.

Return value

string The portion of $str specified by the $start and $length parameters.

2 calls to SearchApiDbService::mbStrcut()
SearchApiDbService::findFreeColumn in ./service.inc
Finds a free column name within a database table.
SearchApiDbService::findFreeTable in ./service.inc
Finds a free table name using a certain prefix and name base.

File

./service.inc, line 2310
Contains SearchApiDbService.

Class

SearchApiDbService
Indexes and searches items using the database.

Code

protected static function mbStrcut($str, $start, $length = NULL) {
  global $multibyte;
  if ($multibyte == UNICODE_MULTIBYTE) {
    return mb_strcut($str, $start, $length);
  }
  return substr($str, $start, $length);
}