1
0
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:
Alexander Medvednikov
2019-12-10 14:32:12 +03:00
parent 4e69c40e12
commit cdfbb2978d
5 changed files with 177 additions and 1 deletions

View File

@@ -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'