How to determine the width of a float number

jgavlik

  • Full Member
  • ***
    • Posts: 15
    • View Profile
I'm using the TinyScreen+ and would like to determine the width of a float number (with 2 places to the right of the decimal). 

Looks like you can do this with strings as in
  int width=display.getPrintWidth("Example Text!");

So is there a similar way to do it with float numbers??

Thanks,

John


lennevia

  • Administrator
  • Sr. Member
  • *****
    • Posts: 94
    • View Profile
Hey John,

A simple workaround could be converting the floating number to a char: https://stackoverflow.com/questions/2988791/converting-float-to-char

So you can continue using the same function.

Hope that works for you!

-Réna



 

SMF spam blocked by CleanTalk