1[manpage_begin textutil::tabify n 0.7] 2[see_also regexp(n)] 3[see_also split(n)] 4[see_also string(n)] 5[keywords formatting] 6[keywords string] 7[keywords tabstops] 8[moddesc {Text and string utilities, macro processing}] 9[titledesc {Procedures to (un)tabify strings}] 10[category {Text processing}] 11[require Tcl 8.2] 12[require textutil::tabify [opt 0.7]] 13[description] 14 15The package [package textutil::tabify] provides commands that convert 16between tabulation and ordinary whitespace in strings. 17 18[para] 19 20The complete set of procedures is described below. 21 22[list_begin definitions] 23 24[call [cmd ::textutil::tabify::tabify] [arg string] [opt [arg num]]] 25 26Tabify the [arg string] by replacing any substring of [arg num] space 27chars by a tabulation and return the result as a new string. [arg num] 28defaults to 8. 29 30[call [cmd ::textutil::tabify::tabify2] [arg string] [opt [arg num]]] 31 32Similar to [cmd ::textutil::tabify] this command tabifies the 33 34[arg string] and returns the result as a new string. A different 35algorithm is used however. Instead of replacing any substring of 36[arg num] spaces this command works more like an editor. [arg num] 37defaults to 8. 38 39[para] 40 41Each line of the text in [arg string] is treated as if there are 42tabstops every [arg num] columns. Only sequences of space characters 43containing more than one space character and found immediately before 44a tabstop are replaced with tabs. 45 46[call [cmd ::textutil::tabify::untabify] [arg string] [opt [arg num]]] 47 48Untabify the [arg string] by replacing any tabulation char by a 49substring of [arg num] space chars and return the result as a new 50string. [arg num] defaults to 8. 51 52[call [cmd ::textutil::tabify::untabify2] [arg string] [opt [arg num]]] 53 54Untabify the [arg string] by replacing any tabulation char by a 55substring of at most [arg num] space chars and return the result as a 56new string. Unlike [cmd textutil::tabify::untabify] each tab is not 57replaced by a fixed number of space characters. The command overlays 58each line in the [arg string] with tabstops every [arg num] columns 59instead and replaces tabs with just enough space characters to reach 60the next tabstop. This is the complement of the actions taken by 61[cmd ::textutil::tabify::tabify2]. [arg num] defaults to 8. 62 63[para] 64 65There is one asymmetry though: A tab can be replaced with a single 66space, but not the other way around. 67 68[list_end] 69 70[vset CATEGORY textutil] 71[include ../common-text/feedback.inc] 72[manpage_end] 73