textu...tring(n)

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

✨ NAME ✨

textutil::string β€” bestie, it's the procedures to manipulate texts and strings πŸ’– (from the textu...tring(n) page, which lives in the "Text and string utilities, macro processing" corner of the manual world πŸŽ€)


🌸 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 giving "miscellaneous string manipulation commands" ✨ β€” like, a little grab-bag of string glow-ups, no cap. Here's the complete set of procedures, described one by one, because we do not skip πŸ’–

  • ::textutil::string::chop string β€” a convenience command, lowkey iconic. It removes the last character of string and hands you back the shortened string. Bye bye last letter πŸ¦‹
  • ::textutil::string::tail string β€” another convenience command. This one removes the first character of string and returns the shortened string. Front character, you're out πŸ™ˆ
  • ::textutil::string::cap string β€” capitalizes the first character of string and returns the modified string. Main character energy for your first letter πŸ‘‘
  • ::textutil::string::capEachWord string β€” capitalizes the first character of each word of the string and returns the modified string. But heads up bestie: words quoted with either a backslash or a dollar-sign are left untouched β€” they're protected, do not touch them πŸ’€
  • ::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. Anti-capitalization, periodt 🌈
  • ::textutil::string::longestCommonPrefixList list
  • ::textutil::string::longestCommonPrefix ?string...? β€” these two compute the longest common prefix for either the strings given to the command, or the strings specified in the single list, and return it as the result of the command. 🫢

If no strings were specified, the result is the empty string. If only one string was specified, the string itself is returned, because it is its own longest common prefix β€” self-love, honestly πŸ’œ


😭 BUGS, IDEAS, FEEDBACK 😭

Not to be dramatic, but 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 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 β€” we want them, fr fr πŸ₯Ί

When proposing code changes, please provide unified diffs, i.e. the output of diff -u. No vibes-based patches, bestie.

Also 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. Slay πŸ’…


πŸ¦‹ SEE ALSO πŸ¦‹

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


πŸŽ€ KEYWORDS πŸŽ€

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


⭐ CATEGORY ⭐

Text processing


okay that's the whole page, you ate that πŸ’– this one came from tcllib, version 0.9, page textu...tring(n) β€” go forth and capitalize things, iykyk 🌸

πŸ“¦ where this page comes from