From cc31cf4d5356bc668d0ff18da25068f0f196b032 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 19 Oct 2021 17:28:59 +0200 Subject: [PATCH] [String] Document trimPrefix() and trimSufix() methods --- components/string.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/string.rst b/components/string.rst index 48f17f0b3e9..e4901d9591c 100644 --- a/components/string.rst +++ b/components/string.rst @@ -306,6 +306,16 @@ Methods to Pad and Trim u(' Lorem Ipsum ')->trimStart(); // 'Lorem Ipsum ' u(' Lorem Ipsum ')->trimEnd(); // ' Lorem Ipsum' + // removes the given content(s) from the start/end of the string + u('file-0001.png')->trimPrefix('file-'); // '0001.png' + u('file-0001.png')->trimPrefix(['file-', 'image-']); // '0001.png' + u('template.html.twig')->trimSuffix('.twig'); // 'template.html' + u('template.html.twig')->trimSuffix(['.twig', '.html']); // 'template' + +.. versionadded:: 5.4 + + The ``trimPrefix()`` and ``trimSuffix()`` methods were introduced in Symfony 5.4. + Methods to Search and Replace ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy