5. String Manipulation

This chapter describes Tcl’s facilities for manipulating strings. Internally, Tcl stores strings as Unicode characters, but Tcl supports a variety of other character sets and can translate between character sets automatically and on demand. Tcl also supports handling binary strings. Tcl’s string manipulation commands include pattern matching in two different forms: one that mimics the rules used by shells for file name expansion and another that uses regular expressions as patterns. Tcl also has commands for formatted input and output in a style similar to the C procedures scanf and printf. Finally, there are several utility commands for computing the length of a string, extracting characters from a string, case conversion, ...

Get Tcl and the Tk Toolkit, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.