| 1 | module builtin |
| 2 | |
| 3 | import strings |
| 4 | |
| 5 | pub 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 | |
| 12 | pub 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 | |
| 24 | pub fn (c rune) str() string { |
| 25 | res := '' |
| 26 | #res.str = String.fromCharCode(Number(c.val)) |
| 27 | |
| 28 | return res |
| 29 | } |
| 30 | |