mtext_compare(3m17n)

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

✨ NAME ✨

mtext_compare β€” bestie's fave way to compare two chunks of M-text πŸ’–

(no description in the original, and honestly? the name speaks for itself, iykyk)


🌸 SYNOPSIS 🌸

int mtext_compare (MText * mt1, int from1, int to1, MText * mt2, int
from2, int to2)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, the tea β˜•: mtext_compare() compares specified regions of two M-texts. It takes mt1 and mt2 and goes character-by-character, like it's reading them side by side with a little magnifying glass πŸ”

Here's exactly which bits it's looking at:

  • in mt1, the region runs between from1 and to1
  • in mt2, the region runs between from2 and to2

and the boundary rules are so important bestie, listen:

  • from1 and from2 are inclusive β€” the character at that index is invited to the party πŸŽ‰
  • to1 and to2 are exclusive β€” that index is NOT included, it's giving "you're not on the list" πŸ’…

so if from1 equals to1 (or from2 equals to2), that's an M-text of length zero. Yep, empty region, no characters, nothing to compare, it's just vibing as nothing ✨

and now the messy part πŸ™ˆ: if you hand it an invalid region specification, it's treated as if both from1 and to1 (or from2 and to2) are 0. Like, it just resets to zero and moves on. That's the rule, no cap.


πŸ‘‘ RETURN VALUE πŸ‘‘

This function returns one of three numbers, and they mean exactly this:

  • 1 β€” mt1 is found greater than mt2
  • 0 β€” mt1 is found equal to mt2
  • -1 β€” mt1 is found less than mt2

and the comparison is based on character codes... wait, character codes. periodt. πŸ”₯


🌈 SEE ALSO 🌈

the whole comparison squad, go check them out bestie:

  • mtext_cmp()
  • mtext_ncmp()
  • mtext_casecmp()
  • mtext_ncasecmp()
  • mtext_case_compare()

Copyright (C) 2001 Information-technology Promotion Agency (IPA) Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST) Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.

and that's the whole page, bestie!! 🫢 this was Version 1.8.4, dated Mon Sep 25 2023, from the m17n Library manual (that's 3m17n to you and me πŸ’…). go forth and compare some M-texts, you absolute icon πŸ‘‘βœ¨πŸŽ€

πŸ“¦ where this page comes from