c-smile / sciter-sdk

Sciter is an embeddable HTML/CSS/scripting engine

Home Page:http://sciter.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement toFixed() for Float

SonnyX opened this issue · comments

I just found out that sciter does not have a toFixed function, and only has String.printf("%.1f", download_progress) as a substitute.
It might be nice to include a toFixed function in the future.

It might be nice to include a toFixed function in the future.

Sure, just define it if you need that:

function Float.toFixed(frac) {
  return String.printf("%.*f", frac,this);
}

debug log: (3.1415).toFixed(2); // outputs "3.14"