feat: add Std::Fmt — string formatting module

- C runtime: bux_float_to_string() for float64 → String conversion
- String.bux: add String_FromFloat, extern decl for bux_float_to_string
- library/std/Fmt.bux: Fmt_Fmt1, Fmt_Fmt2, Fmt_Fmt3, Fmt_FmtInt, Fmt_FmtInt2,
  Fmt_FmtFloat, Fmt_FmtBool — positional {0}, {1}, {2} placeholders
- Refactor examples to use Fmt:
  factorial.bux, fibonacci.bux, process.bux, os_time.bux
This commit is contained in:
2026-06-05 21:05:00 +03:00
parent 6d4543ead9
commit db9025f3a3
13 changed files with 97 additions and 37 deletions
+5
View File
@@ -24,6 +24,7 @@ extern func bux_sb_free(sb: *void);
extern func bux_str_split_count(s: String, delim: String) -> uint;
extern func bux_str_split_part(s: String, delim: String, index: uint) -> String;
extern func bux_str_join2(a: String, b: String, sep: String) -> String;
extern func bux_float_to_string(f: float64) -> String;
extern func bux_str_format(pattern: String, a0: String, a1: String, a2: String, a3: String, a4: String, a5: String, a6: String, a7: String) -> String;
@@ -178,6 +179,10 @@ func String_Replace(s: String, old: String, new: String) -> String {
return result;
}
func String_FromFloat(f: float64) -> String {
return bux_float_to_string(f);
}
func String_Format1(pattern: String, a0: String) -> String {
return bux_str_format(pattern, a0, "", "", "", "", "", "", "");
}