Skip to content

Commit

Permalink
std/fmt: refactor documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jan 17, 2025
1 parent 8ee592a commit 9c8d8e9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions std/fmt/format.jule
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,22 @@ fn format(fmt: str, args: ...any): []byte {
// but for unusupported types it uses default runtime string conversion function of type.
//
// Formatting:
// Arguments are processed sequentially. That is, when an argument
// encounters a format string parameter, it will be processed according
// to how many parameters it is. The 5th parameter uses the 5th argument
// as the value.
// Arguments are processed sequentially. That is, when an argument
// encounters a format string parameter, it will be processed according
// to how many parameters it is. The 5th parameter uses the 5th argument
// as the value.
//
// Each format parameter is represented as "{}" in the format string.
// These parameters will then be deleted according to the processing
// algorithm and replaced with arguments.
// Each format parameter is represented as "{}" in the format string.
// These parameters will then be deleted according to the processing
// algorithm and replaced with arguments.
//
// The parameter "{{}}" is formatted as "{}" actually,
// And does not increase argument list offset.
// The parameter "{{}}" is formatted as "{}" actually,
// And does not increase argument list offset.
//
// Examples:
// - Format("{} {}!", "Hello", "World") = "Hello World!"
// - Format("{} {}") = "{} {}"
// - Format("{} is the {}", "Pi Number") = "Pi Number is the {}"
// Format("{} {}!", "Hello", "World") = "Hello World!"
// Format("{} {}") = "{} {}"
// Format("{} is the {}", "Pi Number") = "Pi Number is the {}"
fn Format(fmt: str, args: ...any): str {
ret unsafe::StrFromBytes(format(fmt, args...))
}

0 comments on commit 9c8d8e9

Please sign in to comment.