Tcl_StringMatch(3)

πŸ“¦
version 9.0.3 Β· 3 versions
, in alpine 3.23, alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– NAME πŸ’–

Tcl_StringMatch, Tcl_StringCaseMatch β€” bestie, these two are literally here to test whether a string matches a pattern ✨


🌸 SYNOPSIS 🌸

#include <tcl.h>

int
Tcl_StringMatch(str, pattern)

int
Tcl_StringCaseMatch(str, pattern, flags)

πŸŽ€ ARGUMENTS πŸŽ€

  • const char *str (in) β€” the string you're putting on the vibe check. πŸ‘€
  • const char *pattern (in) β€” the pattern you're matching against that string. It may contain special characters from the set *?\[] β€” yep, those four are the main characters here. πŸ‘‘
  • int flags (in) β€” an OR-ed combination of match flags. Right now the only one on the roster is TCL_MATCH_NOCASE. Pass 0 and you get a case-sensitive search, no cap.

✨ DESCRIPTION ✨

Okay so, this utility procedure figures out whether a string matches a given pattern. Does it match? Tcl_StringMatch hands you back 1. Does it not? You get 0. That's the whole thing, fr fr. 🫢

The algorithm it uses for matching is the same algorithm used in the string match Tcl command, and it's similar to the algorithm the C-shell uses for file name matching. Want the details? Go read the Tcl manual entry for it, iykyk. πŸ’…

Now in Tcl_StringCaseMatch, the algorithm is the same, but you get the option to make the matching case-insensitive. If you choose that (by passing TCL_MATCH_NOCASE), then the string and the pattern are essentially matched in the lower case. Lowercase everything and let them vibe. 🌈


πŸ¦‹ KEYWORDS πŸ¦‹

match, pattern, string


and that's the whole page, bestie β€” no notes, she ate πŸ’…

this one came from the Tcl Library Procedures, version 8.5, dated the same as ever, and the footer just says Tcl_StringMatch(3) β€” mwah, periodt πŸŽ€

πŸ“¦ where this page comes from