mtext_del(3m17n)

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

πŸ’– mtext_del β€” the m17n Library πŸ’–

okay bestie, so this one's from the m17n Library manual, section 3m17n, and it's genuinely one of the most satisfying little functions ever. it's giving "ctrl+a delete but make it ✨C✨". let's get into it 🫢


✨ SYNOPSIS ✨

int mtext_del (MText * mt, int from, int to)

like. three args. that's it. no cap. πŸ‘‘


🌸 DESCRIPTION 🌸

so the mtext_del() function destructively deletes the characters in the range from from (inclusive) to to (exclusive) from the M-text mt. key word: destructively. we are not making a cute little copy and editing that, bestie β€” we are going in and removing them for real. the original mt itself gets changed.

and because you just deleted (to - from) characters, the length of mt shrinks by exactly that much. math is mathing. πŸ’…

🫢 friendly reminder: from is included, to is not. so the character sitting at index to survives, bestie. she lives. periodt.

🌈 RETURN VALUE 🌈

  • if everything went smoothly, mtext_del() returns 0. slay. ✨
  • otherwise it returns -1, and it assigns an error code to the external variable merror_code. so like, when it fails, it fails loudly, and the receipts are in merror_code. 😭

πŸ’€ ERRORS πŸ’€

  • MERROR_RANGE β€” yeah so this is the one that pops up when the range you handed over is not it. πŸ™ˆ

πŸŽ€ SEE ALSO πŸŽ€

  • mtext_ins() β€” the opposite vibe. she puts characters in. πŸ’–

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>.


okay that's the whole page, bestie, every last crumb of it. πŸ’œ this was Version 1.8.4, dated Mon Sep 25 2023, and it's the mtext_del(3m17n) page from the m17n Library docs. go forth and delete responsibly, my main character. πŸ¦‹βœ¨

πŸ“¦ where this page comes from