1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

StringsBuilder => strings.Builder; strings.repeat()

This commit is contained in:
Alexander Medvednikov
2019-07-03 22:11:27 +02:00
parent e35ff0533b
commit 5d4d3b838b
10 changed files with 61 additions and 30 deletions

View File

@ -795,18 +795,6 @@ pub fn (c byte) is_white() bool {
return i == 10 || i == 32 || i == 9 || i == 13 || c == `\r`
}
// TODO move this to strings.repeat()
pub fn repeat_char(c byte, n int) string {
if n <= 0 {
return ''
}
mut arr := malloc(n + 1)
for i := 0; i < n; i++ {
arr[i] = c
}
arr[n] = `\0`
return tos(arr, n)
}
pub fn (s string) hash() int {
mut hash := int(0)