1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: add a contains_only method on string (#14830)

This commit is contained in:
l-m
2022-06-23 08:41:42 +10:00
committed by GitHub
parent a7108ff05c
commit ed8c63cc0b
2 changed files with 24 additions and 0 deletions

View File

@@ -447,6 +447,13 @@ fn test_contains_any() {
assert !''.contains_any('')
}
fn test_contains_only() {
assert '23885'.contains_only('0123456789')
assert '23gg885'.contains_only('01g23456789')
assert !'hello;'.contains_only('hello')
assert !''.contains_only('')
}
fn test_contains_any_substr() {
s := 'Some random text'
assert s.contains_any_substr(['false', 'not', 'rand'])