FUNCTION::SUBSTR(3stap)

πŸ’– FUNCTION::SUBSTR β€” bestie edition πŸ’–

okay so this is a page from the SystemTap Tapset Reference, manual section 3stap, and it's literally all about one lil function that lives in a collection of standard string tapset stuff. it's giving "small but mighty". let's go πŸ¦‹


✨ NAME ✨

function::substr β€” Returns a substring πŸ’…

like. that's it. that's the whole job. it hands you back a lil slice of a string. iconic behavior honestly.


πŸŽ€ SYNOPSIS πŸŽ€

substr:string(str:string,start:long,length:long)

so it takes three things and gives you back a string. no cap. πŸ”₯


🌸 ARGUMENTS 🌸

  • str β€” the string you're gonna take a substring from. your source material. your main character string. πŸ’œ
  • start β€” the starting position of the extracted string. and bestie, listen: the first character is 0. not 1. zero. the classic zero-index situation. don't come for me, that's just how it is πŸ™ˆ
  • length β€” how long the string you want back should be. that's the length of the string to return. πŸŽ€

πŸ’– DESCRIPTION πŸ’–

so basically: it returns the substring of the given string, at the given start position, with the given length. cute, right?

BUT β€” and this is the important part, bestie, don't skip it β€” you might get something smaller than the length you asked for. it gets trimmed down when either:

  • the length of the original string is less than start + length, or
  • length is bigger than MAXSTRINGLEN.

so like, if you're asking for more characters than there are to give, it just... gives you what it can. it's doing its best. 🫢 no error, no drama, just a shorter substring than you asked for. lowkey generous of it tbh.


πŸ‘‘ SEE ALSO πŸ‘‘

  • tapset::string(3stap) β€” go read this one too, fr fr, it's the whole string tapset and it slays 🌈

and that's the whole page!! go write some tapsets, you absolute genius 🧚✨

this came to you from the SystemTap Tapset Reference, version info reading Ver, dated September 2026 β€” so yeah, fresh off the press, periodt. πŸ’…πŸ“

πŸ“¦ where this page comes from