[TASK] Optimize GeneralUtility::trimExplode()

This often used method can be about 5% more performant by rewriting it.

Change-Id: Iee80a35ebd98c3521a75977bc7ab45d170858e24
Resolves: #55198
Releases: 6.2
Reviewed-on: https://review.typo3.org/27086
Reviewed-by: Markus Klein
Tested-by: Markus Klein