rgbds icon indicating copy to clipboard operation
rgbds copied to clipboard

Improve string/interpolation formatting

Open Rangi42 opened this issue 1 year ago • 0 comments

  • The # component is renamed from "prefix" to "exact"
  • The # component for type s now escapes the string characters
    • Example: "%#s" given "\"\t\\" formats as "\\"\\t\\\\"
      • This is useful for code generation: something like "MACRO foo\ndb \"%#s\", 0\nENDM" will work for any string, even containing characters like "\n" or "\0"
  • The # component for type f now prints a precision suffix
    • Example: "%#.2f" given 12.34q8 formats as "12.34q8"
  • The new q component specifies a precision value (valid with type f)
    • Example: "%.2q8f" given 12.34q8 formats as "12.34" even under opt Q16

Rangi42 avatar Aug 24 '24 15:08 Rangi42