Skip to content

Commit 31b109a

Browse files
committed
better explanation for truncate function
1 parent f50462c commit 31b109a

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

content/feature/expression-language/string-expression-functions/_index.en.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,29 @@ foo: '@=dateTime(input["updated_at"], "YYYY-MM-ddTHH:ii:ss", "Europe/Paris")'
4343

4444
## List of available functions
4545

46-
| Name | Description |
47-
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
48-
| format(`string` format, `mixed` ...inputs): `string` | Formats a string using the [sprintf](https://www.php.net/manual/en/function.sprintf.php) syntax |
49-
| trim(`string` input): `string` | Trims whitespaces from a string |
50-
| capitalize(`string` input): `string` | Makes a string's first character uppercase |
51-
| toLowerCase(`string` input): `string` | Makes a string lowercase |
52-
| search(`string` input, `int` offset, `?int` length = null): `string` | Returns part of a string |
53-
| toUpperCase(`string` input): `string` | Makes a string uppercase |
54-
| formatNumber(`float` num, `int` decimals = 0, `?string` decimal_separator = ".", `?string` thousands_separator = ","): `string` | Formats a number with grouped thousands |
55-
| indexOf(`string` haystack, `string` needle, `int` offset = 0): `int`|`false` | Finds the position of the first occurrence of a substring in a string |
56-
| replace(`string` search, `string` replace, `string` input): `string` | Replaces the `search` values in the string by the `replace` |
57-
| stripHtml(`string` string, `array`|`string`|`null` allowed_tags = null): `string` | Strips HTML and PHP tags from a string |
58-
| decode(`string` string, `array`|`string`|`null` allowed_tags = null): `mixed` | Decodes a JSON string |
59-
| replaceByExpression(`string`|`array` pattern, `string`|`array` replacement, `string`|`array` subject, `int` limit = -1, `int` &count = null): `string`|`array`|`null` | Performs a regular expression search and replace |
60-
| capitalizeWords(`string` string, `string` separators = " \t\r\n\f\v"): `string` | Uppercase’s the first character of each word in a string |
61-
| removeWhitespaces(`string` string, `string` characters = " \n\r\t\v\x00"): `string` | Strips whitespace (or other characters) from the end of a string |
62-
| splitIntoArray(`string` separator, `string` string): `array` | Splits a string by a string |
63-
| fileName(`string` path): `string` | Extracts the file name from the path name |
64-
| dateTime(`string` dateTime, `string` format, `string` timezone = 'UTC'): `date` | Creates a date object from a formatted date |
65-
| formatDate(`date` dateTime, `string` format): `string` | Transforms a date object into a formatted date string |
66-
| now(`string` timezone): `string` | Returns a new \DateTime object with the given timezone |
67-
| convertCharCode(`string` text, `string` sourceCharCode, `string` destinationCharCode): `string` | Converts a string from one character encoding to another |
68-
| asFloat(`string` value): `string` | Converts the value into a float number |
69-
| asInteger(`string` value): `string` | Converts the value to an integer |
70-
| asString(`string` value): `string` | Converts the value into a string |
71-
| truncate(`string` input, `int` limit): `string` | Truncates a value and adds "…" at the end of it |
46+
| Name | Description |
47+
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
48+
| format(`string` format, `mixed` ...inputs): `string` | Formats a string using the [sprintf](https://www.php.net/manual/en/function.sprintf.php) syntax |
49+
| trim(`string` input): `string` | Trims whitespaces from a string |
50+
| capitalize(`string` input): `string` | Makes a string's first character uppercase |
51+
| toLowerCase(`string` input): `string` | Makes a string lowercase |
52+
| search(`string` input, `int` offset, `?int` length = null): `string` | Returns part of a string |
53+
| toUpperCase(`string` input): `string` | Makes a string uppercase |
54+
| formatNumber(`float` num, `int` decimals = 0, `?string` decimal_separator = ".", `?string` thousands_separator = ","): `string` | Formats a number with grouped thousands |
55+
| indexOf(`string` haystack, `string` needle, `int` offset = 0): `int`|`false` | Finds the position of the first occurrence of a substring in a string |
56+
| replace(`string` search, `string` replace, `string` input): `string` | Replaces the `search` values in the string by the `replace` |
57+
| stripHtml(`string` string, `array`|`string`|`null` allowed_tags = null): `string` | Strips HTML and PHP tags from a string |
58+
| decode(`string` string, `array`|`string`|`null` allowed_tags = null): `mixed` | Decodes a JSON string |
59+
| replaceByExpression(`string`|`array` pattern, `string`|`array` replacement, `string`|`array` subject, `int` limit = -1, `int` &count = null): `string`|`array`|`null` | Performs a regular expression search and replace |
60+
| capitalizeWords(`string` string, `string` separators = " \t\r\n\f\v"): `string` | Uppercase’s the first character of each word in a string |
61+
| removeWhitespaces(`string` string, `string` characters = " \n\r\t\v\x00"): `string` | Strips whitespace (or other characters) from the end of a string |
62+
| splitIntoArray(`string` separator, `string` string): `array` | Splits a string by a string |
63+
| fileName(`string` path): `string` | Extracts the file name from the path name |
64+
| dateTime(`string` dateTime, `string` format, `string` timezone = 'UTC'): `date` | Creates a date object from a formatted date |
65+
| formatDate(`date` dateTime, `string` format): `string` | Transforms a date object into a formatted date string |
66+
| now(`string` timezone): `string` | Returns a new \DateTime object with the given timezone |
67+
| convertCharCode(`string` text, `string` sourceCharCode, `string` destinationCharCode): `string` | Converts a string from one character encoding to another |
68+
| asFloat(`string` value): `string` | Converts the value into a float number |
69+
| asInteger(`string` value): `string` | Converts the value to an integer |
70+
| asString(`string` value): `string` | Converts the value into a string |
71+
| truncate(`string` input, `int` limit): `string` | Truncates the value. If the limit is 10 and the input goes above that limit, 9 characters will be kept and `…` will be added at the end. |

docs/feature/expression-language/string-expression-functions/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ <h2 id="installation">Installation</h2>
567567
</tr>
568568
<tr>
569569
<td>truncate(<code>string</code> input, <code>int</code> limit): <code>string</code></td>
570-
<td>Truncates a value and adds &ldquo;…&rdquo; at the end of it</td>
570+
<td>Truncates the value. If the limit is 10 and the input goes above that limit, 9 characters will be kept and <code></code> will be added at the end.</td>
571571
</tr>
572572
</tbody>
573573
</table>

0 commit comments

Comments
 (0)