public static function Connection::sqlFunctionSubstringIndex
public static Connection::sqlFunctionSubstringIndex($string, $delimiter, $count)
SQLite compatibility implementation for the SUBSTRING_INDEX() SQL function.
File
- core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php, line 240
Class
- Connection
- SQLite implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\Core\Database\Driver\sqliteCode
public static function sqlFunctionSubstringIndex($string, $delimiter, $count) { // If string is empty, simply return an empty string. if (empty($string)) { return ''; } $end = 0; for ($i = 0; $i < $count; $i++) { $end = strpos($string, $delimiter, $end + 1); if ($end === FALSE) { $end = strlen($string); } } return substr($string, 0, $end); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!sqlite!Connection.php/function/Connection::sqlFunctionSubstringIndex/8.1.x