Skip to content

Enhanced Patterns #2899

@deeprobin

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')

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