Posted to tcl by dandyn at Sun Nov 12 21:37:53 GMT 2023view raw
- proc check:unit {views} {
- if {1000000 > $views} {
- if {99999 >= $views} {set views [regsub (..) $views {\1 }]}
- if {100000 <= $views && $views < 1000000} {set views [regsub (...) $views {\1 }]}
- } elseif {1000000 <= $views} {
- if {1000000 <= $views && $views <= 9999999} {
- set views "[string range $views 0 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"
- } else {
- set views "[string range $views 0 0] md"
- }
- }
- return "$views"
- }