studio icon indicating copy to clipboard operation
studio copied to clipboard

String.format(): Discrepancy between display of result in edit vs run or debug modes

Open bentron2000 opened this issue 1 year ago • 1 comments

Have noticed a bug in version 0.16.1 in the implementation of String.format() Discrepancy between display of result in edit vs run or debug modes.

To Reproduce:

  1. Create a label on any screen.
  2. Make the label an expression with String.format(".2f",1.1)
  3. In EDIT mode, observe the label correctly display as 1.10
  4. Switch to RUN or DEBUG mode, observe the label display as .2f

Expected behavior Expect the result to be 1.10 in both cases.

Desktop :

  • MacOS 14.4
  • Version 0.16.1

** LVGL version**

  • 9.x

bentron2000 avatar Sep 20 '24 03:09 bentron2000

Format specification for the String.format function when used in LVGL project must use % prefix. So, your expression should be String.format("%.2f",1.1).

mvladic avatar Sep 20 '24 14:09 mvladic