Skip to content

Limit string by number of words #68

@omundy

Description

@omundy

Is there a way to limit a string by the number of words? I tried a few ways to get at it.

Str("To be or not to be").words().limit(3).get()

I'm doing it right now with:

Str(text).words().slice(0,5).join(" ") + "...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions