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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 402 additions and 397 deletions

View file

@ -4,12 +4,12 @@ import strings
fn generate_temp_html() string {
mut temp_html := strings.new_builder(200)
temp_html.write('<!doctype html><html><head><title>Giant String</title></head><body>')
temp_html.write_string('<!doctype html><html><head><title>Giant String</title></head><body>')
for counter := 0; counter < 4; counter++ {
temp_html.write("<div id='name_$counter' ")
temp_html.write("class='several-$counter'>Look at $counter</div>")
temp_html.write_string("<div id='name_$counter' ")
temp_html.write_string("class='several-$counter'>Look at $counter</div>")
}
temp_html.write('</body></html>')
temp_html.write_string('</body></html>')
return temp_html.str()
}