Clownf...terator(3pm)

πŸ“¦
version 0.8.0 Β· 3 versions
, in fedora 43, fedora 44

πŸ’– Clownf...terator(3pm) πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation, and it's all about Clownfish::StringIterator β€” yes the title got chopped up in the header but we're gonna say the whole thing properly, promise 🫢


✨ NAME ✨

Clownfish::StringIterator β€” iterate Unicode code points in a String. that's it, that's the gig πŸ’…


🌸 SYNOPSIS 🌸

my $iter = $string->top;
while (my $code_point = $iter->next) {
    ...
}

like. look at that. a whole loop. iconic behavior honestly 😭


πŸ¦‹ DESCRIPTION πŸ¦‹

ngl the original page just puts the heading here and then immediately starts listing methods β€” no extra prose, no filler, just vibes and method docs. so we're going straight into it, no cap.


πŸ‘‘ METHODS πŸ‘‘

πŸŽ€ clone

my $result = $string_iterator->clone();

hands you back a clone of the object. a whole copy. twin energy πŸ’–


πŸŽ€ assign

$string_iterator->assign($other);

takes the source string and the current position from other and hands them over to self. like passing the aux cord but also the exact timestamp you were at 🎧


πŸŽ€ compare_to

my $int = $string_iterator->compare_to($other);

tells you whether one StringIterator is less than, equal to, or greater than another one, by comparing their character positions.

⚠️ heads up bestie: it throws an exception if other isn't a StringIterator pointing to the same source string as self. don't try to compare two iterators from different strings, it will not go well πŸ’€

Returns: 0 if the StringIterators are equal, a negative number if self is less than other, and a positive number if self is greater than other.


πŸŽ€ has_next

my $bool = $string_iterator->has_next();

returns true if the iterator is not at the end of the string. is there more? yes or no. simple as 🌈


πŸŽ€ has_prev

my $bool = $string_iterator->has_prev();

returns true if the iterator is not at the start of the string. can we go back? yes or no ✨


πŸŽ€ next

my $code_point = $iter->next;

returns the code point after the current position and advances the iterator. two-for-one, ate that πŸ“

  • returns undef at the end of the string
  • returns zero but true for U+0000 β€” yes, sneaky, that's the whole point, don't @ me πŸ’…

πŸŽ€ prev

my $code_point = $iter->prev;

returns the code point before the current position and goes one step back. the rewind button, but fancy 🧚

  • returns undef at the start of the string
  • returns zero but true for U+0000 β€” same little trap, same little truth πŸ’œ

πŸŽ€ advance

my $int = $string_iterator->advance($num);

skip code points. forward. zoom πŸš€

  • num β€” the number of code points to skip.

Returns: the number of code points actually skipped. this can be less than the requested number if the end of the string is reached. the string said "no more", and honestly, respect 🫢


πŸŽ€ recede

my $int = $string_iterator->recede($num);

skip code points backward. the reverse zoom πŸŒ™

  • num β€” the number of code points to skip.

Returns: the number of code points actually skipped. this can be less than the requested number if the start of the string is reached. can't go past the beginning, babes πŸ’–


πŸŽ€ skip_whitespace

my $int = $string_iterator->skip_whitespace();

skips whitespace. and by whitespace we mean any character that has the Unicode property "White_Space" β€” the real definition, not just "spacebar", iykyk πŸ”₯

Returns: the number of code points skipped.


πŸŽ€ skip_whitespace_back

my $int = $string_iterator->skip_whitespace_back();

skips whitespace backward. and again, whitespace is any character that has the Unicode property "White_Space" 🌸

Returns: the number of code points skipped.


πŸŽ€ starts_with

my $bool = $string_iterator->starts_with($prefix);

tests whether the content after the iterator starts with prefix. looking forward, checking the vibe check βœ…


πŸŽ€ ends_with

my $bool = $string_iterator->ends_with($suffix);

tests whether the content before the iterator ends with suffix. looking backward, checking the vibe check βœ…


🌈 INHERITANCE 🌈

Clownfish::StringIterator isa Clownfish::Obj. family tree confirmed, bloodline slay πŸ‘‘


and that's the whole page bestie, every method, every return value, every U+0000 gotcha, nothing skipped, periodt πŸ’…βœ¨

this was perl v5.42.3, dated 2026-09-02, straight out of the User Contributed Perl Documentation πŸŽ€ thanks for reading, love u, go iterate something πŸ’–πŸ¦‹

πŸ“¦ where this page comes from