Skip to content

Enhanced Patterns #2899

Description

@deeprobin

std::pattern::Pattern could be "hello".
Example:

let s = "hello world":
s.contains("hello"): // ==> true

But it is also faster to do multi checks instead of using multiple contains functions.

Bad practise

s.contains('a') || s.contains('b') // about 51ns because the string makes two checks.

I created myself a Pattern implementation which is about 19ns and does just one check. But I think there must be a own pattern syntax.
Something like:

s.contains('a' || 'b')

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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