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

all: add strings.Builder.write_string and use write_string instead of write (#8892)

This commit is contained in:
zakuro
2021-02-22 20:18:11 +09:00
committed by GitHub
parent 36a6bc270c
commit f54c1a5cc2
34 changed files with 402 additions and 397 deletions

View File

@ -490,17 +490,17 @@ pub fn (a &array) free() {
// => '["a", "b", "c"]'.
pub fn (a []string) str() string {
mut sb := strings.new_builder(a.len * 3)
sb.write('[')
sb.write_string('[')
for i in 0 .. a.len {
val := a[i]
sb.write("'")
sb.write(val)
sb.write("'")
sb.write_string("'")
sb.write_string(val)
sb.write_string("'")
if i < a.len - 1 {
sb.write(', ')
sb.write_string(', ')
}
}
sb.write(']')
sb.write_string(']')
return sb.str()
}