Posted to tcl by dandyn at Sun Nov 12 21:37:53 GMT 2023view raw

  1. proc check:unit {views} {
  2.  
  3.  
  4. if {1000000 > $views} {
  5.  
  6. if {99999 >= $views} {set views [regsub (..) $views {\1 }]}
  7. if {100000 <= $views && $views < 1000000} {set views [regsub (...) $views {\1 }]}
  8.  
  9. } elseif {1000000 <= $views} {
  10.  
  11. if {1000000 <= $views && $views <= 9999999} {
  12. set views "[string range $views 0 0] mn"
  13.  
  14. } elseif {10000000 <= $views && $views <= 99999999} {
  15. set views "[string range $views 0 1] mn"
  16.  
  17. } elseif {100000000 <= $views && $views <= 999999999} {
  18. set views "[string range $views 0 2] mn"
  19.  
  20. } else {
  21. set views "[string range $views 0 0] md"
  22. }
  23. }
  24.  
  25. return "$views"
  26. }
  27.