Skip to content

Remove empty lines from String#each_line #15149

@straight-shoota

Description

@straight-shoota

String#each_line splits a string by line separator (LF or CRLF) and yields each individual line. Sometimes only populated lines are interesting, so you want to remove all empty ones. This can be accomplished by manual filtering. But that adds extra complexity to the call site. I think it would be useful to have a parameter remove_empty : Bool similar to String#split. #each_line is essentially a special case variant of #split.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions