aboutsummaryrefslogtreecommitdiff
path: root/core/strings
diff options
context:
space:
mode:
authorJon Lipstate <Jon@Lipstate.com>2023-04-26 18:04:24 -0700
committerJon Lipstate <Jon@Lipstate.com>2023-04-26 18:04:24 -0700
commitf9b5f2b7b1d1f83de988b751d184353ce596d295 (patch)
treec2f815edbf8f5b4fd2ff031053172e9580ca8a69 /core/strings
parent67fa5df89c70f7da958443b4ec4cbdc3b515cffa (diff)
update builder sample
Diffstat (limited to 'core/strings')
-rw-r--r--core/strings/builder.odin11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/strings/builder.odin b/core/strings/builder.odin
index 6e809c4f6..edde4b297 100644
--- a/core/strings/builder.odin
+++ b/core/strings/builder.odin
@@ -81,13 +81,12 @@ Example:
import "core:fmt"
import "core:strings"
builder_make_example :: proc() {
- sb := strings.builder_make() // Can also use the len, len/cap versions here
+ sb := strings.builder_make()
strings.write_byte(&sb, 'a')
- strings.write_rune(&sb, ' ')
- strings.write_string(&sb, "slice of ")
- strings.write_f64(&sb, 3.14) // Also _float, _f32 etc
- strings.write_string(&sb, "is ")
- strings.write_int(&sb, 180) // Also _uint, _u64 etc
+ strings.write_string(&sb, " slice of ")
+ strings.write_f64(&sb, 3.14,'g',true) // See `fmt.fmt_float` byte codes
+ strings.write_string(&sb, " is ")
+ strings.write_int(&sb, 180)
strings.write_rune(&sb,'°')
the_string :=strings.to_string(sb)
fmt.println(the_string)