Files
Packer-Cn/website/content/docs/templates/hcl_templates/functions/string/chomp.mdx
T
50da6c8dc8 docs: Migrate link formats (#12192)
* Adding check-legacy-links-format workflow

* Adding test-link-rewrites workflow

* Migrating links to new format

* Updating docs-content-check-legacy-links-format hash

* chore: update source

* Update generated partials from Packer plugin SDK

* Bump packer-plugin-sdk to get latest packer-sdc

* Update website/content/docs/templates/hcl_templates/blocks/build/provisioner.mdx

* Update Plugin SDK to fix shell-local regression

---------

Co-authored-by: Kendall Strautman <[email protected]>
Co-authored-by: Wilken Rivera <[email protected]>
Co-authored-by: Kendall Strautman <[email protected]>
2023-01-27 09:47:08 -08:00

28 lines
640 B
Plaintext

---
page_title: chomp - Functions - Configuration Language
description: The chomp function removes newline characters at the end of a string.
---
# `chomp` Function
`chomp` removes newline characters at the end of a string.
This can be useful if, for example, the string was read from a file that has
a newline character at the end.
## Examples
```shell-session
> chomp("hello\n")
hello
> chomp("hello\r\n")
hello
> chomp("hello\n\n")
hello
```
## Related Functions
- [`trimspace`](/packer/docs/templates/hcl_templates/functions/string/trimspace), which removes all types of whitespace from
both the start and the end of a string.