v2 / vlib / builtin / js / rune.js.v
29 lines · 23 sloc · 468 bytes · 971feb8f89fa4f3cacf16228a9ad23a388d0f883
Raw
1module builtin
2
3import strings
4
5pub fn (ra []rune) string() string {
6 mut sb := strings.new_builder(ra.len)
7 sb.write_runes(ra)
8 res := sb.str()
9 return res
10}
11
12pub fn (c rune) repeat(count int) string {
13 if count <= 0 {
14 return ''
15 } else if count == 1 {
16 return c.str()
17 }
18 res := ''
19 #res.str = String.fromCharCode(Number(c.val))
20
21 return res.repeat(count)
22}
23
24pub fn (c rune) str() string {
25 res := ''
26 #res.str = String.fromCharCode(Number(c.val))
27
28 return res
29}
30