Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contains instance method for strings #449

Merged

Conversation

blurgyy
Copy link
Contributor

@blurgyy blurgyy commented Mar 15, 2023

I currently use a dirty hack to achieve the functionality of contains method:

fn contains(s, sub) {
  s.len() != s.replace(sub, "").len()
}

It would be nice if Rune just supports .contains IMHO.

I currently use a dirty hack to achieve the functionality of `contains`
method:

```rust
fn contains(s, sub) {
  s.len() != s.replace(sub, "").len()
}
```

It would be nice if Rune just supports `.contains` IMHO.

Signed-off-by: Gaoyang Zhang <gy@blurgy.xyz>
@udoprog udoprog added the enhancement New feature or request label Mar 15, 2023
@udoprog
Copy link
Collaborator

udoprog commented Mar 15, 2023

Thank you!

@udoprog udoprog merged commit 6483b3a into rune-rs:main Mar 15, 2023
@blurgyy blurgyy deleted the add-contains-instance-method-for-strings branch March 16, 2023 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants