View Single Post
Old 08-03-2025, 07:55 PM   #8
Far_Pen_6884
Enthusiast
Far_Pen_6884 began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Jul 2025
Device: paperwhite
Quote:
Originally Posted by Far_Pen_6884 View Post
```plaintext
program:
switch_if(
field('#wordcount') >= 1000000, format_number(divide(field('#wordcount'),1000000), '{:.1f}M'),
field('#wordcount') >= 1000, format_number(divide(field('#wordcount'),1000), '{:.1f}K'),
field('#wordcount')
)
```
the above doesn't work correctly, this works
Code:
program:
    first_matching_cmp($$#word_count,
        1000, $$#word_count,
        1000000, format_number($$#word_count / 1000, '{:.1f} K'),
        format_number($$#word_count / 1000000, '{:.1f} M')
    )
Far_Pen_6884 is offline   Reply With Quote