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:
@@ -0,0 +1 @@
|
||||
[Package]
|
||||
@@ -0,0 +1,11 @@
|
||||
import Std::Io::{PrintLine};
|
||||
import Std::Fmt;
|
||||
|
||||
func Main() -> int {
|
||||
PrintLine(Fmt_Fmt1("Hello, {0}!", "World"));
|
||||
PrintLine(Fmt_FmtInt("Count: {0}", 42));
|
||||
PrintLine(Fmt_FmtFloat("Pi: {0}", 3.14159));
|
||||
PrintLine(Fmt_FmtBool("Active: {0}", true));
|
||||
PrintLine(Fmt_Fmt2("Name: {0}, Age: {1}", "Bux", String_FromInt(5)));
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user