TYPO3 CMS  TYPO3_8-7
TYPO3\CMS\Core\Utility\StringUtility Class Reference

Static Public Member Functions

static beginsWith ($haystack, $needle)
 
static endsWith ($haystack, $needle)
 
static getUniqueId ($prefix='')
 
static escapeCssSelector (string $selector)
 
static removeByteOrderMark (string $input)
 

Detailed Description

Class with helper functions for string handling

Definition at line 20 of file StringUtility.php.

Member Function Documentation

◆ beginsWith()

static TYPO3\CMS\Core\Utility\StringUtility::beginsWith (   $haystack,
  $needle 
)
static

Returns TRUE if $haystack begins with $needle. The input string is not trimmed before and search is done case sensitive.

Parameters
string$haystackFull string to check
string$needleReference string which must be found as the "first part" of the full string
Exceptions

Definition at line 31 of file StringUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\StringUtilityTest\beginsWithReturnsFalseForNotMatchingFirstPart(), TYPO3\CMS\Core\Tests\Unit\Utility\StringUtilityTest\beginsWithReturnsThrowsExceptionWithInvalidArguments(), TYPO3\CMS\Core\Tests\Unit\Utility\StringUtilityTest\beginsWithReturnsTrueForMatchingFirstPart(), and TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem\getOperatingSystem().

◆ endsWith()

◆ escapeCssSelector()

static TYPO3\CMS\Core\Utility\StringUtility::escapeCssSelector ( string  $selector)
static

Escape a CSS selector to be used for DOM queries

This method takes care to escape any CSS selector meta character. The result may be used to query the DOM like $('#' + escapedSelector)

Parameters
string$selector
Returns
string

Definition at line 106 of file StringUtility.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Utility\StringUtilityTest\escapeCssSelector(), and TYPO3\CMS\Backend\Form\Container\InlineControlContainer\renderPossibleRecordsSelectorTypeGroupDB().

◆ getUniqueId()

static TYPO3\CMS\Core\Utility\StringUtility::getUniqueId (   $prefix = '')
static

This function generates a unique id by using the more entropy parameter. Furthermore the dots are removed so the id can be used inside HTML attributes e.g. id.

Parameters
string$prefix
Returns
string

Definition at line 91 of file StringUtility.php.

Referenced by TYPO3\CMS\Rsaauth\Backend\CommandLineBackend\__wakeup(), TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseUniqueUidNewRow\addData(), TYPO3\CMS\Impexp\Import\addSingle(), TYPO3\CMS\Install\FolderStructure\DirectoryNode\canFileBeCreated(), TYPO3\CMS\Core\DataHandling\DataHandler\checkValue_flex_procInData_travDS(), TYPO3\CMS\Install\Controller\Action\Tool\TestSetup\combineImages(), TYPO3\CMS\Backend\Controller\FormFlexAjaxController\containerAdd(), TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\AbstractActionTestCase\createLocalizedContent(), TYPO3\CMS\Rsaauth\Backend\CommandLineBackend\decrypt(), TYPO3\CMS\Core\Utility\GeneralUtility\flushDirectory(), TYPO3\CMS\Core\Database\QueryGenerator\getDateTimePickerField(), TYPO3\CMS\Install\Controller\Action\Tool\TestSetup\getEmailSubject(), TYPO3\CMS\Install\Service\CoreUpdateService\getMessages(), TYPO3\CMS\Core\Database\DatabaseConnection\getSelectMmQueryParts(), TYPO3\CMS\Backend\View\PageLayoutView\getTable_pages(), TYPO3\CMS\Core\Tests\Unit\Utility\StringUtilityTest\getUniqueIdReturnsIdWithoutDot(), TYPO3\CMS\Core\Tests\Unit\Utility\StringUtilityTest\getUniqueIdReturnsIdWithPrefix(), TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler\HookTest\hooksAreExecutedForNewRelations(), TYPO3\CMS\Core\DataHandling\DataHandler\insertNewCopyVersion(), TYPO3\CMS\Core\DataHandling\DataHandler\localize(), TYPO3\CMS\Core\Tests\Functional\DataHandling\IRRE\ForeignField\AbstractActionTestCase\localizeParentContentAndCreateNestedChildrenWithLanguageSynchronization(), TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Hooks\PagesTsConfigGuardTest\pagesTsConfigIsConsideredForAdminUser(), TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\Hooks\PagesTsConfigGuardTest\pagesTsConfigIsIgnoredForNonAdminUser(), TYPO3\CMS\Form\Tests\Functional\Hooks\FormFileExtensionUpdateTest\performUpdateSucceedsHavingOutdatedExtensionReferencesWithFinisherOverrides(), TYPO3\CMS\Form\Tests\Functional\Hooks\FormFileExtensionUpdateTest\performUpdateSucceedsHavingOutdatedStorageReferencesWithFinisherOverrides(), TYPO3\CMS\Core\Cache\Backend\RedisBackend\removeIdentifierEntriesAndRelations(), TYPO3\CMS\Rsaauth\Form\Element\RsaInputElement\render(), TYPO3\CMS\Backend\Form\Element\InputColorPickerElement\render(), TYPO3\CMS\Backend\Form\Element\InputDateTimeElement\render(), TYPO3\CMS\Backend\Form\Element\SelectCheckBoxElement\render(), TYPO3\CMS\Backend\Form\Element\InputTextElement\render(), TYPO3\CMS\Backend\Form\Element\TextElement\render(), TYPO3\CMS\Backend\Form\Element\TextTableElement\render(), TYPO3\CMS\Backend\Form\Element\InputLinkElement\render(), TYPO3\CMS\Backend\Form\Element\SelectMultipleSideBySideElement\render(), TYPO3\CMS\Backend\Form\Element\GroupElement\render(), TYPO3\CMS\Backend\Form\Element\ImageManipulationElement\render(), TYPO3\CMS\Backend\Form\Element\SelectMultipleSideBySideElement\renderReadOnly(), TYPO3\CMS\Backend\Form\Element\SelectSingleBoxElement\renderSelectElement(), TYPO3\CMS\Core\Package\PackageManager\saveToPackageCache(), TYPO3\CMS\Install\Controller\Action\Tool\TestSetup\scaleImages(), TYPO3\CMS\Core\Cache\Backend\FileBackend\set(), TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend\set(), TYPO3\CMS\Core\DataHandling\Localization\DataMapProcessor\synchronizeInlineRelations(), TYPO3\CMS\Form\Tests\Functional\Hooks\FormFileExtensionUpdateTest\updateIsNotRequiredHavingUpdatedStorageReferencesWithFinisherOverrides(), TYPO3\CMS\Form\Tests\Functional\Hooks\FormFileExtensionUpdateTest\updateIsRequiredHavingOutdatedExtensionReferencesWithFinisherOverrides(), and TYPO3\CMS\Form\Tests\Functional\Hooks\FormFileExtensionUpdateTest\updateIsRequiredHavingOutdatedStorageReferencesWithFinisherOverrides().

◆ removeByteOrderMark()

static TYPO3\CMS\Core\Utility\StringUtility::removeByteOrderMark ( string  $input)
static

Removes the Byte Order Mark (BOM) from the input string. This method supports UTF-8 encoded strings only!

Parameters
string$input
Returns
string

Definition at line 117 of file StringUtility.php.

Referenced by TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser\error(), and TYPO3\CMS\Core\Tests\Unit\Utility\StringUtilityTest\removeByteOrderMark().