Skip to content

There are some problems in the String documentation. #14261

@luminecs

Description

@luminecs

I was reading some elixir documentation recently. Today I found that the following statements have inconsistent results.

doc url

Image

Executing these statements on my computer gave different results.

user@fedora:~$ iex
Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.18.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> String.chunk(<<?a, ?b, ?c, 0>>, :valid)
[<<97, 98, 99, 0>>]
iex(2)> String.chunk(<<?a, ?b, ?c, 0, 0xFFFF::utf16>>, :valid)
[<<97, 98, 99, 0>>, <<255, 255>>]
iex(3)> String.chunk(<<?a, ?b, ?c, 0, 0x0FFFF::utf8>>, :printable)
["abc", <<0, 239, 191, 191>>]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions