function LocaleJs::stripQuotes
Same name and namespace in other branches
- main core/modules/locale/src/LocaleJs.php \Drupal\locale\LocaleJs::stripQuotes()
Removes the quotes and string concatenations from the string.
Parameters
string $string: Single or double quoted strings, optionally concatenated by plus (+) sign.
Return value
string String with leading and trailing quotes removed.
1 call to LocaleJs::stripQuotes()
- LocaleJs::parseJsFile in core/
modules/ locale/ src/ LocaleJs.php - Parses a JavaScript file, extracts translatable strings, and saves them.
File
-
core/
modules/ locale/ src/ LocaleJs.php, line 454
Class
- LocaleJs
- Provides the locale javascript related methods.
Namespace
Drupal\localeCode
protected function stripQuotes(string $string) : string {
return implode('', preg_split('~(?<!\\\\)[\'"]\\s*\\+\\s*[\'"]~s', substr($string, 1, -1)));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.