Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.47 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Tcl add a symbol N time at the end of the string
  2. % format "|%-25s|" hello
  3. |hello                    |
  4.        
  5. % set width 25
  6. 25
  7. % format "|%-*s|" $width hello
  8. |hello                    |
  9.        
  10. set padded [format "%-25s" $str]
  11.        
  12. set padded $str[string repeat " " [expr {25 - [string length $str]}]]
  13.        
  14. for {set padded $str} {[string length $padded] < 25} {} {
  15.     append padded " "
  16. }
  17.        
  18. set padded [binary format "A25" $str]
  19.        
  20. % string repeat : 25
  21. :::::::::::::::::::::::::