Skip to content

Document the Strings format function in ext/README.md - #1473

Open
Sanjays2402 wants to merge 2 commits into
cel-expr:masterfrom
Sanjays2402:docs-string-format-readme
Open

Document the Strings format function in ext/README.md#1473
Sanjays2402 wants to merge 2 commits into
cel-expr:masterfrom
Sanjays2402:docs-string-format-readme

Conversation

@Sanjays2402

Copy link
Copy Markdown

Fixes #1116

The Strings extension supports <string>.format(<list>) since version 1
(ext/strings.go), but the function was accidentally omitted from the
documented Strings functions in ext/README.md. This adds the missing
documentation entry, matching the implementation's documented behavior.

Test evidence:

  • No code changed, so no unit tests were added. Instead, every example in
    the new README section was evaluated against the interpreter
    (cel.NewEnv(ext.Strings())) and the documented outputs verified:
    • "this is a string: %s and an integer: %d".format(["str", 42]) -> "this is a string: str and an integer: 42"
    • "%f".format([3.14]) -> "3.140000"
    • "5 in binary: %b".format([5]) -> "5 in binary: 101"
    • "26 in hex: %x".format([26]) -> "26 in hex: 1a"
    • "26 in hex (uppercase): %X".format([26]) -> "26 in hex (uppercase): 1A"
    • "30 in octal: %o".format([30]) -> "30 in octal: 36"
    • "duration: %s".format([duration("1h45m47s")]) -> "duration: 6347s"

The Strings extension supports <string>.format(<list>) since version 1
(ext/strings.go), but the function was accidentally omitted from the
documented Strings functions in ext/README.md. This adds the missing
documentation entry, matching the implementation's documented behavior,
with example outputs verified against the interpreter.

Fixes cel-expr#1116
@TristonianJones

Copy link
Copy Markdown
Collaborator

/gcbrun

Comment thread ext/README.md
@TristonianJones

Copy link
Copy Markdown
Collaborator

/gcbrun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

string.format missing from cel-go/ext/README.md

2 participants