From 159fe842fe95ae3683eb3f89d168c3ad8ab5fe7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 11 Sep 2023 10:28:41 +0200 Subject: [PATCH] Update lib/elixir/pages/anti-patterns/design-anti-patterns.md --- lib/elixir/pages/anti-patterns/design-anti-patterns.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/elixir/pages/anti-patterns/design-anti-patterns.md b/lib/elixir/pages/anti-patterns/design-anti-patterns.md index feccb70cc71..e598c49d8f9 100644 --- a/lib/elixir/pages/anti-patterns/design-anti-patterns.md +++ b/lib/elixir/pages/anti-patterns/design-anti-patterns.md @@ -82,9 +82,9 @@ defmodule AlternativeInteger do @spec parse(String.t(), keyword()) :: integer() | {integer(), String.t()} | :error def parse(string, options \\ []) when is_list(options) do if Keyword.get(options, :discard_rest, false) do - String.to_integer(string) + Integer.parse(string) else - case String.parse(string) do + case Integer.parse(string) do {int, _rest} -> int :error -> :error end