mtext_character(3m17n)

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

πŸ’– mtext_character β€” the m17n Library's lil character-hunter πŸ’–

okay bestie, so this is a page from the m17n Library manual β€” mtext_character(3m17n) β€” and honestly? she's a baddie. she finds characters. that's it. that's the job. let's get into it ✨


🌸 SYNOPSIS 🌸

int mtext_character (MText * mt, int from, int to, int c)

like, that's the whole vibe right there. four args, one int coming back at ya. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so basically: this function searches a character in an M-text. yeah. she's a searcher. πŸ”

mtext_character() looks through the M-text mt for the character c. cute, right? but here's the tea on direction, because it matters:

  • if from is less than to, the search starts at position from and goes forward β€” but it does not exceed (to - 1).
  • otherwise (so, from is not less than to), the search starts at position (from - 1) and goes backward β€” but it does not exceed to.

and if you hand her an invalid position specification? she just treats it as both from and to being 0. no drama, no crash, she just quietly goes "aight, zeroes it is" πŸ’…


✨ RETURN VALUE ✨

okay so what do you get back:

  • if c is found, mtext_character() returns the position of its first occurrence. iconic. πŸ‘‘
  • if it's not found, she returns -1 β€” and without changing the external variable merror_code. no touching. she respects the variable's boundaries fr fr.
  • if an error is detected, she returns -1 and assigns an error code to the external variable merror_code. 🚨

🌈 SEE ALSO 🌈

go read these next, bestie, they're the sibling group chat:

  • mtext_chr()
  • mtext_rchr()

real talk, the legal bits, verbatim because we do NOT play with licensing:

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, angel 🫢 go forth and find your characters. this was Version 1.8.4, dated Mon Sep 25 2023, and yeah β€” she ate. periodt. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from