mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Add exists method to map
This commit is contained in:
parent
31a03ae93e
commit
229417244d
@ -133,6 +133,16 @@ fn (m map) get(key string, out voidptr) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
fn (m map) exists(key string) bool {
|
||||
for i := 0; i < m.entries.len; i++ {
|
||||
entry := m.entries[i]
|
||||
if entry.key == key {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fn (m map) print() {
|
||||
println('<<<<<<<<')
|
||||
for i := 0; i < m.entries.len; i++ {
|
||||
@ -169,4 +179,3 @@ fn (m map_string) str() string {
|
||||
s += '}'
|
||||
return s
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user