mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
strings: replace_each([]); orm: update
This commit is contained in:
@@ -219,6 +219,22 @@ fn test_replace() {
|
||||
assert c.replace('','-') == c
|
||||
}
|
||||
|
||||
fn test_replace_each() {
|
||||
s := 'hello man man :)'
|
||||
q := s.replace_each([
|
||||
'man', 'dude',
|
||||
'hello', 'hey'
|
||||
])
|
||||
assert q == 'hey dude dude :)'
|
||||
bb := '[b]bold[/b] [code]code[/code]'
|
||||
assert bb.replace_each([
|
||||
'[b]', '<b>',
|
||||
'[/b]', '</b>',
|
||||
'[code]', '<code>',
|
||||
'[/code]', '</code>'
|
||||
]) == '<b>bold</b> <code>code</code>'
|
||||
}
|
||||
|
||||
fn test_itoa() {
|
||||
num := 777
|
||||
assert num.str() == '777'
|
||||
|
Reference in New Issue
Block a user