Posted to tcl by dandyn at Sun Nov 12 21:55:22 GMT 2023view raw
- proc check:unit {views} {
- if {1000000 > $views} {
- if {99999 >= $views && $views >= 10000} {set views [regsub (..) $views {\1 }]}
- if {100000 <= $views && $views < 1000000} {set views [regsub (...) $views {\1 }]}
- } else {
- if {1000000 <= $views && $views <= 9999999} {
- set views "[string index $views 0] mn"
- } elseif {10000000 <= $views && $views <= 99999999} {
- set views "[string range $views 0 1] mn"
- } elseif {100000000 <= $views && $views <= 999999999} {
- set views "[string range $views 0 2] mn"
- } elseif {1000000000 <= $views} {
- set views "[string index $views 0] md"
- }
- }
- return "$views"
- }