Skip to content

String.trim("abc", "") won't return anything #5210

@Ljzn

Description

@Ljzn

Environment

  • Elixir version (elixir -v): v 1.3.2
  • Operating system: OSX

Current behavior

When try to trim a string with "":

iex> String.trim("abc", "")
iex> String.trim_leading("abc", "")
iex> String.trim_trailing("abc", "")

The iex will stunned, and didn't raise any error.

Expected behavior

iex> String.trim("abc", "")
iex> "abc"

It's reasonable that we can't use String.replace("abc", "", ""). But I think when we trim a string with "", that should return string itself.
What do you think of?

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