Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make string/character quoting rules explicit #5006

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions doc/manual/strings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Characters
A ``Char`` value represents a single character: it is just a 32-bit
integer with a special literal representation and appropriate arithmetic
behaviors, whose numeric value is interpreted as a `Unicode code
point <https://en.wikipedia.org/wiki/Code_point>`_. Here is how ``Char``
values are input and shown:
point <https://en.wikipedia.org/wiki/Code_point>`_. A ``Char``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar: "Char values", not "A Char values. And I would phrase it:

  • Char literal values are delimited by single quotes:

values must be input in single quotes:

.. doctest::

Expand Down Expand Up @@ -184,7 +184,10 @@ You can do comparisons and a limited amount of arithmetic with
String Basics
-------------

Here a variable is initialized with a simple string literal:
String literals are typed in double quotes `"..." or triple double
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer "are delimited by" to "are typed in"

quotes `"""..."""`; the latter form is called a 'triple-quoted string'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In American English, one would typically use double quotes for defining the term "triple-quoted string". Or you could italicize it.

for short. Here a variable is initialized with a simple string literal
ending in a newline:

.. doctest::

Expand Down Expand Up @@ -249,7 +252,7 @@ You can also extract a substring using range indexing:
julia> str[4:9]
"lo, wo"

Note the distinction between ``str[k]`` and ``str[k:k]``:
Writing ``str[k]`` or ``str[k:k]`` does not give the same result:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would phrase it:

  • The expressions str[k] and str[k:k] do not give the same result:


.. doctest::

Expand Down