String...Extent(3pm)

πŸ“¦
version 0.24 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ String::Tagged::Extent ✨

okay so bestie, welcome to String::Tagged::Extent β€” that's the Perl module (a 3pm page, iykyk) that gives you lil range objects living inside a String::Tagged. πŸŽ€


πŸ’– NAME πŸ’–

String::Tagged::Extent β€” the module that represents a range within a String::Tagged. periodt.


🌸 DESCRIPTION 🌸

So here's the tea: these objects represent a range of characters inside the containing String::Tagged object. The range they represent is fixed at the time of creation β€” locked in, no takebacks. πŸ”’

⚠️ But listen: if the containing string gets modified by a call to set_substr, then the effect on the extent object is not defined. Like, we don't know what happens. Chaos. Undefined behaviour. πŸ’€

So treat these objects as relatively short-lived β€” use them briefly to query the result of an operation, then discard them soon after. They're giving "situationship, not a long-term commitment" energy. πŸ™ˆ


πŸ¦‹ METHODS πŸ¦‹

string

$extent->string;

Returns the containing String::Tagged object. It's giving "who's your parent" energy. πŸ‘‘

start

$extent->start;

Returns the start index of the extent. This is the index of the first character within the extent. ✨

end

$extent->end;

Returns the end index of the extent. This is the index of the first character beyond the end of the extent. Yes bestie, it's the character after the last one β€” that's just how it is. πŸ’…

anchor_before

$extent->anchor_before;

True if this extent begins "before" the start of the string. Only certain methods return extents with this flag defined. πŸ‘€

anchor_after

$extent->anchor_after;

True if this extent ends "after" the end of the string. Again, only certain methods return extents with this flag defined. πŸ”₯

length

$extent->length;

Returns the number of characters within the extent. Math but make it cute. πŸ”’

substr

$extent->substr;

Returns the substring contained by the extent, as a String::Tagged complete with all the relevant tag values. It's the full package, tags and all. 🫢

plain_substr

$extent->plain_substr;

Returns the substring of the underlying plain string buffer contained by the extent, as a plain Perl string. No tags, no drama, just the raw text. 🌈


πŸ‘‘ AUTHOR πŸ‘‘

Paul Evans <leonerd@leonerd.org.uk> β€” the icon, the legend, the main character who wrote this. πŸŽ€


okay that's the whole page bestie, you ate it up fr fr πŸ’œ

This one's from perl v5.38.2, dated 2024-07-24, and it lives at String...Extent(3pm) β€” mwah, go forth and query your extents. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from