Skip to content

request for function std.contains #381

Open
@ghostsquad

Description

@ghostsquad

This is a request to have a stdlib function for contains. Right now, I'm using something like:

strContains(s, substr):: (
	std.length(std.findSubstr(substr, s)) > 0
)

But the problem is that findSubstr is doing a regex, so I need to be aware of that and escape, which is not always possible, if that value isn't hard-coded.

edit or at least that's how it reads from the documentation:

std.findSubstr(pat, str)

Returns an array that contains the indexes of all occurances of pat in str.

the use of pat being short for pattern usually meaning regex.

Is there another way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation improvementsstdlib

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions