wiki/content/20201116130327-keep_last_word.md

19 lines
324 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-29 18:27:12 +00:00
date: 2020-11-16
2024-05-06 20:40:05 +00:00
id: 5bb1ce24-7cdc-495f-b3d8-39f06f19e5bc
title: Keep last word
---
# Description
Keep last word when truncating.
# Syntax
``` php
use function Symfony\Component\String\u;
u('Lorem Ipsum')->truncate(8, '…'); // 'Lorem I…'
u('Lorem Ipsum')->truncate(8, '…', false); // 'Lorem Ipsum'
```