Clownf...terator(3pm)
π 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 ifotherisn't a StringIterator pointing to the same source string asself. 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
undefat 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
undefat 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
- fedora 43: perl-Clownfish 0.8.0-1.fc43 Β· Apache-2.0
- fedora 44: perl-Clownfish 0.8.0-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms