summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEksperimental <eksperimental@users.noreply.github.com>2018-12-09 14:44:15 +0700
committerJosé Valim <jose.valim@gmail.com>2018-12-09 08:44:15 +0100
commit1c03026d80d9c0239d13e41ee2d2d8b784d9f3d9 (patch)
treed73c919012f7161c8fec3ed976659c24325448fa
parentaf3203cb26d66a3f8299145d0f849a5c1919bd8b (diff)
downloadelixir-1c03026d80d9c0239d13e41ee2d2d8b784d9f3d9.tar.gz
Elaborate on which characters are considered printable in charlists (#8492)
-rw-r--r--lib/elixir/lib/list.ex20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/elixir/lib/list.ex b/lib/elixir/lib/list.ex
index 8addc819f..87346662d 100644
--- a/lib/elixir/lib/list.ex
+++ b/lib/elixir/lib/list.ex
@@ -448,14 +448,28 @@ defmodule List do
do_zip(list_of_lists, [])
end
- @doc """
+ @doc ~S"""
Checks if a list is a charlist made only of printable ASCII characters.
- A printable charlist in Elixir contains only ASCII characters.
-
Takes an optional `limit` as a second argument. `ascii_printable?/2` only
checks the printability of the list up to the `limit`.
+ A printable charlist in Elixir contains only the printable characters in the
+ standard seven-bit ASCII character encoding, which are characters ranging from
+ 32 to 126 in decimal notation, plus the following control characters:
+
+ * `?\a` - Bell
+ * `?\b` - Backspace
+ * `?\t` - Horizontal tab
+ * `?\n` - Line feed
+ * `?\v` - Vertical tab
+ * `?\f` - Form feed
+ * `?\r` - Carriage return
+ * `?\e` - Escape
+
+ For more information read the [Character groups](https://en.wikipedia.org/wiki/ASCII#Character_groups)
+ section in the Wikipedia article of the [ASCII](https://en.wikipedia.org/wiki/ASCII) standard.
+
## Examples
iex> List.ascii_printable?('abc')