Skip to content

Commit 1f5da5b

Browse files
Use trim in examples instead of deprecated strip
1 parent 7b9b188 commit 1f5da5b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,14 @@ are provided here as examples of the preferred style.
194194
some_string =
195195
"Hello"
196196
|> String.downcase()
197-
|> String.strip()
197+
|> String.trim()
198198
another_string <> some_string
199199

200200
# preferred
201201
some_string =
202202
"Hello"
203203
|> String.downcase()
204-
|> String.strip()
204+
|> String.trim()
205205

206206
another_string <> some_string
207207
```
@@ -351,10 +351,10 @@ are provided here as examples of the preferred style.
351351

352352
```elixir
353353
# not preferred
354-
some_string |> String.downcase |> String.strip
354+
some_string |> String.downcase |> String.trim
355355

356356
# preferred
357-
some_string |> String.downcase() |> String.strip()
357+
some_string |> String.downcase() |> String.trim()
358358
```
359359

360360
* <a name="function-names-with-parentheses"></a>
@@ -448,22 +448,22 @@ generally preferred practice.
448448

449449
```elixir
450450
# not preferred
451-
String.strip(String.downcase(some_string))
451+
String.trim(String.downcase(some_string))
452452

453453
# preferred
454-
some_string |> String.downcase() |> String.strip()
454+
some_string |> String.downcase() |> String.trim()
455455

456456
# Multiline pipelines are not further indented
457457
some_string
458458
|> String.downcase()
459-
|> String.strip()
459+
|> String.trim()
460460

461461
# Multiline pipelines on the right side of a pattern match
462462
# should be indented on a new line
463463
sanitized_string =
464464
some_string
465465
|> String.downcase()
466-
|> String.strip()
466+
|> String.trim()
467467
```
468468

469469
While this is the preferred method, take into account that copy-pasting
@@ -489,10 +489,10 @@ generally preferred practice.
489489

490490
```elixir
491491
# not preferred
492-
String.strip(some_string) |> String.downcase() |> String.codepoints()
492+
String.trim(some_string) |> String.downcase() |> String.codepoints()
493493

494494
# preferred
495-
some_string |> String.strip() |> String.downcase() |> String.codepoints()
495+
some_string |> String.trim() |> String.downcase() |> String.codepoints()
496496
```
497497

498498
* <a name="parentheses"></a>

0 commit comments

Comments
 (0)