From 8c971c86d859bb6b5dff825f0f523428b9dcce28 Mon Sep 17 00:00:00 2001 From: Matthew O'Neill Date: Fri, 26 Apr 2024 21:41:00 +0100 Subject: [PATCH 1/2] Add some signposting to the String docs for pattern matching As a user of the docs, when looking for information on how to pattern match with strings and binaries the first place one looks is the String docs. Currently there isn't anything here for pattern matching besides a small example matching a character. The user would either have to go from the reference section to the patterns and guards guide or go to the <<>>/1 special forms docs. This change just adds a link to the special forms docs and the guide to signpost the user to those resources. --- lib/elixir/lib/string.ex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/elixir/lib/string.ex b/lib/elixir/lib/string.ex index 4c1468bf931..7d3f9dc4e3c 100644 --- a/lib/elixir/lib/string.ex +++ b/lib/elixir/lib/string.ex @@ -201,6 +201,9 @@ defmodule String do iex> eacute 233 + See the documentation for [`<<>>`](`<<>>/1`) or the Patterns and Guards + guide for more information on binary pattern matching + You can also fully convert a string into a list of integer code points, known as "charlists" in Elixir, by calling `String.to_charlist/1`: From b4f8ee9556e8402db07a5bc70590e394d0d0c550 Mon Sep 17 00:00:00 2001 From: Matthew O'Neill Date: Sat, 27 Apr 2024 22:56:39 +0100 Subject: [PATCH 2/2] add link to guide and adjust order in signposting --- lib/elixir/lib/string.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/elixir/lib/string.ex b/lib/elixir/lib/string.ex index 7d3f9dc4e3c..d20147bae46 100644 --- a/lib/elixir/lib/string.ex +++ b/lib/elixir/lib/string.ex @@ -201,8 +201,8 @@ defmodule String do iex> eacute 233 - See the documentation for [`<<>>`](`<<>>/1`) or the Patterns and Guards - guide for more information on binary pattern matching + See the [*Patterns and Guards* guide](patterns-and-guards.md) and the documentation for + [`<<>>`](`<<>>/1`) for more information on binary pattern matching. You can also fully convert a string into a list of integer code points, known as "charlists" in Elixir, by calling `String.to_charlist/1`: