Skip to content

new functions: better format (using template) and tostring#66

Merged
pchalamet merged 2 commits intomainfrom
feature/format-pattern
Dec 14, 2024
Merged

new functions: better format (using template) and tostring#66
pchalamet merged 2 commits intomainfrom
feature/format-pattern

Conversation

@pchalamet
Copy link
Contributor

Current format function just transform all values to string and concat. It has been removed in current form (breaking change).

Instead, a new format function is introduce which use a template:

  • format("{0}-{1}", "Debug", "x64"): use indexes for replacement
  • format("{flavour}-{arch}", { flavour: "Debug" arch: "x64" }): use key from map for replacement

Also, format was a concat with value conversion instead: function tostring has been introduced to convert a value to string. To convert current format usage, following example: format("toto", 42)
can be rewritten as "toto" + tostring(42)

@pchalamet pchalamet changed the title add better format function new fucntons: better format (using template) and tostring Dec 14, 2024
@pchalamet pchalamet merged commit a61903a into main Dec 14, 2024
1 check passed
@pchalamet pchalamet changed the title new fucntons: better format (using template) and tostring new funtions: better format (using template) and tostring Dec 14, 2024
@pchalamet pchalamet changed the title new funtions: better format (using template) and tostring new functions: better format (using template) and tostring Dec 14, 2024
@pchalamet pchalamet deleted the feature/format-pattern branch December 14, 2024 22:34
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.

1 participant