text...ring(3tcl)

πŸ“¦
version 2.0 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ textutil::string β€” it's giving string manipulation, bestie ✨

okay so this is the page for textutil::string, from the tcllib collection of text and string utilities / macro processing tools, filed under section 3tcl of the manual. it's a whole lil package of string wrangling procs and honestly? obsessed. πŸ’–


πŸŽ€ NAME πŸŽ€

textutil::string β€” Procedures to manipulate texts and strings.


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require textutil::string ?0.9?

::textutil::string::chop string

::textutil::string::tail string

::textutil::string::cap string

::textutil::string::capEachWord string

::textutil::string::uncap string

::textutil::string::longestCommonPrefixList list

::textutil::string::longestCommonPrefix ?string...?

πŸ’… DESCRIPTION πŸ’…

so the package textutil::string is literally just a lil grab-bag of miscellaneous string manipulation commands. that's the whole vibe. the entire set of procedures is described right below, no gatekeeping here 🫢

  • ::textutil::string::chop string β€” a convenience command, bestie. it takes the last character of string and yeets it into the void, handing back the shortened string. bye felicia πŸ‘‹
  • ::textutil::string::tail string β€” also a convenience command. this one removes the first character of string and returns the shortened string. so like, the opposite end of the same energy πŸ¦‹
  • ::textutil::string::cap string β€” capitalizes the first character of string and returns the modified string. glow-up for your first letter ✨
  • ::textutil::string::capEachWord string β€” capitalizes the first character of every word in the string and returns the modified string. iconic. but β€” and this is important β€” words quoted with either a backslash or a dollar-sign are left untouched. do not touch those, they're protected πŸ™ˆ
  • ::textutil::string::uncap string β€” the complementary operation to ::textutil::string::cap. it forces the first character of string to lower case and returns the modified string. the anti-glow-up, if you will πŸ’œ
  • ::textutil::string::longestCommonPrefixList list
  • ::textutil::string::longestCommonPrefix ?string...? β€” these two compute the longest common prefix for either the strings handed directly to the command, or the strings specified in the single list, and return it as the result of the command.

and the edge cases, because we love a well-behaved proc:

  • if no strings were specified, the result is the empty string.
  • if only one string was specified, that string itself is returned β€” because it's its own longest common prefix, main character energy, no competition πŸ‘‘

πŸ’€ BUGS, IDEAS, FEEDBACK πŸ’€

ngl, this document and the package it describes will undoubtedly contain bugs and other problems. it's not a vibe, it's just reality. please report them in the category textutil of the Tcllib Trackers at:

http://core.tcl.tk/tcllib/reportlist

also please report any ideas for enhancements you have for either the package and/or the documentation, because we wanna hear it fr fr 🫢

when you're proposing code changes, please provide unified diffs, i.e. the output of diff -u. no freestyle.

also note: attachments are strongly preferred over inlined patches. you can attach stuff by going to the Edit form of the ticket immediately after creating it, and then using the left-most button in the secondary navigation bar. iykyk πŸ“Ž

πŸ‘€ SEE ALSO πŸ‘€

regexp(3tcl), split(3tcl), string(3tcl)


πŸ“ KEYWORDS πŸ“

capitalize, chop, common prefix, formatting, prefix, string, uncapitalize


🌈 CATEGORY 🌈

Text processing


tcllib, version 0.9, dated text...ring(3tcl) β€” that's the whole page, bestie. go forth and manipulate some strings, you've got this πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from