textu...abify(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– 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 of num space chars with a tabulation, and hands you back the result as a new string. num defaults to 8.
  • ::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 of num spaces, this command works more like an editor does. num defaults to 8.

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 of num space chars, and return the result as a new string. num defaults to 8. simple. clean. ate πŸ’…
  • ::textutil::tabify::untabify2 string ?num? β€” Untabify the string by replacing any tabulation char with a substring of at most num space chars, and return the result as a new string. unlike textutil::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 every num columns 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. num defaults to 8.
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