From 12bc8e111f365aeed0f5dcffff3d535282e0470d Mon Sep 17 00:00:00 2001 From: rktjmp Date: Wed, 20 Aug 2025 14:43:46 +1000 Subject: [PATCH 1/2] Add hint for generating \0 character to strings guide The Working with Strings guide lists supported escape characters (eg: `\n`, `\t`) but `\0` is not supported by double quote strings. Include an example of generating `NUL` via `\u{0}`, as well as pointing to combining string interpolation with `chars --integer 0`. --- book/working_with_strings.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/book/working_with_strings.md b/book/working_with_strings.md index fe27637f99d..23482678919 100644 --- a/book/working_with_strings.md +++ b/book/working_with_strings.md @@ -56,6 +56,10 @@ Nushell currently supports the following escape characters: - `\n` - newline (line feed) - `\t` - tab - `\u{X...}` - a single unicode character, where X... is 1-6 hex digits (0-9, A-F) + +To create a `\0` (`NUL`) character, you may use `\u{0}` or +[string interpolation](#string-interpolation) with [`char`](/commands/docs/char.md), +e.g. `(char --integer 0)`. ## Raw Strings From 7abfd24a04caa06497a3a4439cc514e6ce761f55 Mon Sep 17 00:00:00 2001 From: rktjmp Date: Wed, 20 Aug 2025 22:03:18 +1000 Subject: [PATCH 2/2] Suggest `char nul` over `char --integer 0` --- book/working_with_strings.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/book/working_with_strings.md b/book/working_with_strings.md index 23482678919..22101f11aae 100644 --- a/book/working_with_strings.md +++ b/book/working_with_strings.md @@ -58,8 +58,7 @@ Nushell currently supports the following escape characters: - `\u{X...}` - a single unicode character, where X... is 1-6 hex digits (0-9, A-F) To create a `\0` (`NUL`) character, you may use `\u{0}` or -[string interpolation](#string-interpolation) with [`char`](/commands/docs/char.md), -e.g. `(char --integer 0)`. +[string interpolation](#string-interpolation) with [`(char nul)`](/commands/docs/char.md). ## Raw Strings