> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# append_trailing_char_if_absent

> If the str string is not empty and does not contain trailing_char character in the end, it appends trailing_char character to the end.

If the str string is not empty and does not contain trailing\_char character in the end, it appends trailing\_char character to the end. trailing\_char can only contain one character. If it contains multiple characters, this function will return NULL.

## Syntax

```Haskell theme={null}
VARCHAR append_trailing_char_if_absent(VARCHAR str, VARCHAR trailing_char)
```

## Examples

```Plain Text theme={null}
MySQL [test]> select append_trailing_char_if_absent('a','c');
+------------------------------------------+
|append_trailing_char_if_absent('a', 'c')  |
+------------------------------------------+
| ac                                       |
+------------------------------------------+
1 row in set (0.02 sec)

MySQL [test]> select append_trailing_char_if_absent('ac','c');
+-------------------------------------------+
|append_trailing_char_if_absent('ac', 'c')  |
+-------------------------------------------+
| ac                                        |
+-------------------------------------------+
1 row in set (0.00 sec)
```

## keyword

APPEND\_TRAILING\_CHAR\_IF\_ABSENT


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.