Advertisement
Xgod22052

Untitled

Mar 22nd, 2021
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. function formatNum(n: number) :: string:
  2. set {_l::*} to split "k,M,B,T,Qn,Qi,Sx" at ","
  3. set {_i} to min(floor(log({_n})/3), size of {_l::*})
  4. return "%{_n}%" if {_i} <= 0
  5. set {_i2} to 1000^{_i}
  6. return "%{_n}/{_i2}%%{_l::%{_i}%}%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement