EgretDoc
Back to Home
Location:system/fmt

Module

Module documentation.

modulefmt
@briefFormatting output
@detailsProvides minimal formatting and printing helpers ("{}" placeholders, at most two replacements).
@see
  • index.html

Classes

Classes and inheritance.

Functions

Free functions and class methods.

functionfmt::__fmt_sprintf1
Signatureextern func __fmt_sprintf1(format: String, a: String) -> String;
extern func __fmt_sprintf1(format: String, a: String) -> String;
/*
@brief Binds the low-level runtime symbol `__fmt_sprintf2`.
@briefBinds the low-level runtime symbol `__fmt_sprintf1`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
  • formatFormat string that controls how arguments are converted to text.
  • aInput value used for comparison, computation, or conversion.
@returnReturns the operation result as `String`.
functionfmt::__fmt_sprintf2
Signatureextern func __fmt_sprintf2(format: String, a: String, b: String) -> String;
extern func __fmt_sprintf2(format: String, a: String, b: String) -> String;

/*
@briefBinds the low-level runtime symbol `__fmt_sprintf2`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
  • formatFormat string that controls how arguments are converted to text.
  • aInput value used for comparison, computation, or conversion.
  • bInput value used for comparison, computation, or conversion.
@returnReturns the operation result as `String`.
functionfmt::print_str
Signaturefunc print_str(s: String) -> Void
func print_str(s: String) -> Void {
    print(s);
}
@briefPrint a string
@detailsDirectly calls the built-in print(s).
@param
  • sContent to print
@returnVoid
functionfmt::println
Signaturefunc println(s: String) -> Void
func println(s: String) -> Void {
    print(s);
}
@briefPrint a string (no guaranteed newline)
@param
  • sContent to print
@returnVoid
@warningIf you need an explicit newline, append "\\n" to s yourself.
functionfmt::sprintf1
Signaturefunc sprintf1(format: String, a: String) -> String
func sprintf1(format: String, a: String) -> String {
    return __fmt_sprintf1(format, a);
}
@briefFormat a string (one argument)
@param
  • formatTemplate string (uses "{}" as a placeholder)
  • aReplacement value (string)
@returnFormatted string
functionfmt::sprintf2
Signaturefunc sprintf2(format: String, a: String, b: String) -> String
func sprintf2(format: String, a: String, b: String) -> String {
    return __fmt_sprintf2(format, a, b);
}
@briefFormat a string (two arguments)
@detailsReplaces two "{}" placeholders by applying Sprintf1 twice.
@param
  • formatTemplate string (uses "{}" as a placeholder)
  • aFirst replacement value
  • bSecond replacement value
@returnFormatted string
@noteThe second replacement is applied to the result of the first replacement.
functionfmt::sprintfv
Signaturefunc sprintfv(format: String, args: collections.Vector<String>) -> String
func sprintfv(format: String, args: collections.Vector<String>) -> String {
    let out: String = format;
    loop (let arg_index: Int = 0; arg_index < args.len(); arg_index += 1) {
@briefFormat a string with variadic string arguments
@detailsReplaces "{}" placeholders from left to right using each String argument.
@param
  • formatTemplate string
  • argsReplacement values
@returnFormatted string
functionfmt::sprintf
Signaturefunc sprintf(format: String, args: ...String) -> String
func sprintf(format: String, args: ...String) -> String {
    return sprintfv(format, args);
}
@briefProvides the system library operation `sprintf`.
@detailsExecutes the `sprintf` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • formatFormat string that controls how arguments are converted to text.
  • argsArgument list forwarded to the command, process, callback, or formatter.
@returnReturns the operation result as `String`.
functionfmt::printf1
Signaturefunc printf1(format: String, a: String) -> Void
func printf1(format: String, a: String) -> Void {
    _ = print_str(sprintf1(format, a));
}
@briefFormat and print (one argument)
@detailsEquivalent to Print(Sprintf1(format, a)).
@param
  • formatTemplate string
  • aReplacement value
@returnVoid
functionfmt::printf2
Signaturefunc printf2(format: String, a: String, b: String) -> Void
func printf2(format: String, a: String, b: String) -> Void {
    _ = print_str(sprintf2(format, a, b));
}
@briefFormat and print (two arguments)
@detailsEquivalent to Print(Sprintf2(format, a, b)).
@param
  • formatTemplate string
  • aFirst replacement value
  • bSecond replacement value
@returnVoid
functionfmt::printf
Signaturefunc printf(format: String, args: ...String) -> Void
func printf(format: String, args: ...String) -> Void {
    _ = print_str(sprintfv(format, args));
}
@briefProvides the system library operation `printf`.
@detailsExecutes the `printf` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • formatFormat string that controls how arguments are converted to text.
  • argsArgument list forwarded to the command, process, callback, or formatter.
@returnVoid
functionfmt::errorf1
Signaturefunc errorf1(format: String, a: String) -> String
func errorf1(format: String, a: String) -> String {
    return sprintf1(format, a);
}
@briefBuild an error message string
@detailsThe current implementation only returns Sprintf1(format, a).
@param
  • formatTemplate string
  • aReplacement value
@returnFormatted string
functionfmt::errorf
Signaturefunc errorf(format: String, args: ...String) -> String
func errorf(format: String, args: ...String) -> String {
    return sprintfv(format, args);
}
@briefProvides the system library operation `errorf`.
@detailsExecutes the `errorf` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • formatFormat string that controls how arguments are converted to text.
  • argsArgument list forwarded to the command, process, callback, or formatter.
@returnReturns the operation result as `String`.

Variables

Class fields (var).