File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -306,11 +306,16 @@ Methods to Pad and Trim
306306 u(' Lorem Ipsum ')->trimStart(); // 'Lorem Ipsum '
307307 u(' Lorem Ipsum ')->trimEnd(); // ' Lorem Ipsum'
308308
309- // removes the given content(s) from the start/end of the string
310- u('file-0001.png')->trimPrefix('file-'); // '0001.png'
311- u('file-0001.png')->trimPrefix(['file-', 'image-']); // '0001.png'
309+ // removes the given content from the start/end of the string
310+ u('file-image-0001.png')->trimPrefix('file-'); // 'image-0001.png'
311+ u('file-image-0001.png')->trimPrefix('image-'); // 'file-image-0001.png'
312+ u('file-image-0001.png')->trimPrefix('file-image-'); // '0001.png'
313+ u('template.html.twig')->trimSuffix('.html'); // 'template.html.twig'
312314 u('template.html.twig')->trimSuffix('.twig'); // 'template.html'
313- u('template.html.twig')->trimSuffix(['.twig', '.html']); // 'template'
315+ u('template.html.twig')->trimSuffix('.html.twig'); // 'template'
316+ // when passing an array of prefix/sufix, only the first one found is trimmed
317+ u('file-image-0001.png')->trimPrefix(['file-', 'image-']); // 'image-0001.png'
318+ u('template.html.twig')->trimSuffix(['.twig', '.html']); // 'template.html'
314319
315320.. versionadded :: 5.4
316321
You can’t perform that action at this time.
0 commit comments