textu...abify(n)
π textu...abify(n) π
okay bestie, gather round, because we're talking about the Text and string utilities, macro processing corner of the Tcllib universe and honestly? it's giving lowercase-but-iconic. β¨
πΈ NAME πΈ
textutil::tabify β the procedures that (un)tabify strings, no cap π
β¨ SYNOPSIS β¨
package require Tcl 8.5 9
package require textutil::tabify ?0.8?
::textutil::tabify::tabify string ?num?
::textutil::tabify::tabify2 string ?num?
::textutil::tabify::untabify string ?num?
::textutil::tabify::untabify2 string ?num?
like, four little commands and a package requirement, and they're all gonna change your whitespace life π«Ά
π¦ DESCRIPTION π¦
so the textutil::tabify package hands you commands that convert between tabulation and ordinary whitespace in strings. that's the whole vibe. tabs in, spaces out, spaces in, tabs out. main character energy for real π₯
The complete set of procedures is described below β and yes, we're doing all of them, nobody's getting skipped π
::textutil::tabify::tabify string ?num?β Tabify that string, bestie π it replaces any substring ofnumspace chars with a tabulation, and hands you back the result as a new string.numdefaults to8.::textutil::tabify::tabify2 string ?num?β Similar to::textutil::tabify, this one tabifies the string and returns the result as a new string too. BUT. A different algorithm is used, okay? instead of replacing any substring ofnumspaces, this command works more like an editor does.numdefaults to8.
Each line of the text in string is treated as if there are tabstops every num columns. Only sequences of space characters that contain more than one space character and are found immediately before a tabstop get replaced with tabs. like, it's picky, and honestly? respect β¨
::textutil::tabify::untabify string ?num?β Untabify the string by replacing any tabulation char with a substring ofnumspace chars, and return the result as a new string.numdefaults to8. simple. clean. ate π::textutil::tabify::untabify2 string ?num?β Untabify the string by replacing any tabulation char with a substring of at mostnumspace chars, and return the result as a new string. unliketextutil::tabify::untabify, each tab is not replaced by a fixed number of space characters. instead, the command overlays each line in the string with tabstops everynumcolumns and replaces tabs with just enough space characters to reach the next tabstop. this is the complement of the actions taken by::textutil::tabify::tabify2.numdefaults to8.
okay so there IS one asymmetry here, and I need you to know it: a tab can be replaced with a single space, but not the other way around. that's just the rules π
π BUGS, IDEAS, FEEDBACK π
ngl, this document β and the package it describes β will undoubtedly contain bugs and other problems. it's giving "we're all human". so please report such things in the category textutil of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. and please also report any ideas for enhancements you may have for either the package and/or the documentation, because we want to hear them fr fr π«Ά
When proposing code changes, please provide unified diffs, i.e. the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. okay that's the whole instruction, don't skip it π
π SEE ALSO π
regexp(n), split(n), string(n) β go read those too, they're the friend group π
β KEYWORDS β
formatting, string, tabstops β three little words, so much power π
π§ CATEGORY π§
Text processing π
and that's the whole page, bestie!! this one came from tcllib, version 0.8, and it's the textu...abify(n) manual page, slay πΈβ¨π
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms