Skip to content

Book: Fix outdated substring output#2100

Merged
fdncred merged 2 commits intonushell:mainfrom
Drazape:main
Apr 10, 2026
Merged

Book: Fix outdated substring output#2100
fdncred merged 2 commits intonushell:mainfrom
Drazape:main

Conversation

@Drazape
Copy link
Copy Markdown
Contributor

@Drazape Drazape commented Jan 2, 2026

In the NuShell book/Nu Fundamentals/Working with strings/The str command/Substrings (book/working_with_strings.md),
the command 'Hello World!' | str substring 4..8''s output is given as o Wo—which would be correct if 8 wasn't included and the output would be of 4 characters, as given in the book.

Running the command internally has shown that 8—in fact inculded in the substring so the correct output shown in the comment should be o Wor (of 5 characters) as it is in the cheat sheet and not o Wo

@Drazape Drazape changed the title Book:Fix incomplete substring output Book: Fix incomplete substring output Jan 2, 2026
@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Jan 2, 2026

I'm sure the syntax has changed since the docs were written. This would also work

'Hello World!' | str substring 4..<8

@Drazape Drazape changed the title Book: Fix incomplete substring output Book: Fix outdated substring output Jan 11, 2026
@fdncred fdncred merged commit 14f76aa into nushell:main Apr 10, 2026
2 checks passed
@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented Apr 10, 2026

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants