Tcl Library Source Code

Bounty program for improvements to Tcl and certain Tcl packages.

[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


textutil - Procedures to manipulate texts and strings.

Table Of Contents


package require Tcl 8.2
package require textutil ?0.8?

::textutil::adjust string args
::textutil::adjust::readPatterns filename
::textutil::adjust::getPredefined filename
::textutil::indent string prefix ?skip?
::textutil::undent string
::textutil::splitn string ?len?
::textutil::splitx string ?regexp?
::textutil::tabify string ?num?
::textutil::tabify2 string ?num?
::textutil::trim string ?regexp?
::textutil::trimleft string ?regexp?
::textutil::trimright string ?regexp?
::textutil::trimPrefix string prefix
::textutil::trimEmptyHeading string
::textutil::untabify string ?num?
::textutil::untabify2 string ?num?
::textutil::strRepeat text num
::textutil::blank num
::textutil::chop string
::textutil::tail string
::textutil::cap string
::textutil::uncap string
::textutil::longestCommonPrefixList list
::textutil::longestCommonPrefix ?string...?


The package textutil provides commands that manipulate strings or texts (a.k.a. long strings or string with embedded newlines or paragraphs). It is actually a bundle providing the commands of the six packages

in the namespace textutil.

The bundle is deprecated, and it will be removed in a future release of Tcllib, after the next release. It is recommended to use the relevant sub packages instead for whatever functionality is needed by the using package or application.

The complete set of procedures is described below.

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category textutil of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

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.


regexp(n), split(n), string(n)


TeX, formatting, hyphenation, indenting, paragraph, regular expression, string, trimming


Text processing