# How to put ASCII codes in strings

**URL:** https://discourse.nodered.org/t/how-to-put-ascii-codes-in-strings/22218
**Category:** General
**Created:** [24 February 2020 22:06 UTC](https://discourse.nodered.org/t/how-to-put-ascii-codes-in-strings/22218 "2020-02-24T22:06:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [24 February 2020 22:06 UTC](https://discourse.nodered.org/t/how-to-put-ascii-codes-in-strings/22218/1 "2020-02-24T22:06:57Z")

</div>

I know this is a dumb question and has been asked before.

I've tried searching but I am lacking the ability to word the question in such a way I get the right answer.

I want to include CHR$(15) in a message a few times.

I guess that I will be using the `template` node, but getting that into a valid syntax is my sticking point.

Someone - please.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [24 February 2020 22:15 UTC](https://discourse.nodered.org/t/how-to-put-ascii-codes-in-strings/22218/2 "2020-02-24T22:15:39Z")

</div>

With a bit of digging I found this could work:

In a `function` node rather than a `template` node.

`msg.payload = msg.payload + String.fromCharCode(15,15,15);`

and it gets the desired result.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [9 March 2020 22:15 UTC](https://discourse.nodered.org/t/how-to-put-ascii-codes-in-strings/22218/3 "2020-03-09T22:15:48Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
