-
-
27 Feb 2018 08:38:55 UTC
- Distribution: Clownfish
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Clone repository
- Issues
- Testers (1313 / 0 / 7)
- Kwalitee
Bus factor: 0- License: apache_2_0
- Perl: v5.8.3
- Activity
24 month- Tools
- Download (230.31KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- The Apache Lucy Project <dev at lucy dot apache dot org>
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Clownfish::StringIterator - Iterate Unicode code points in a String.
SYNOPSIS
my $iter = $string->top; while (my $code_point = $iter->next) { ... }
DESCRIPTION
METHODS
clone
my $result = $string_iterator->clone();
Return a clone of the object.
assign
$string_iterator->assign($other);
Assign the source string and current position of
other
toself
.compare_to
my $int = $string_iterator->compare_to($other);
Indicate whether one StringIterator is less than, equal to, or greater than another by comparing their character positions. Throws an exception if
other
is not a StringIterator pointing to the same source string asself
.Returns: 0 if the StringIterators are equal, a negative number if
self
is less thanother
, and a positive number ifself
is greater thanother
.has_next
my $bool = $string_iterator->has_next();
Return true if the iterator is not at the end of the string.
has_prev
my $bool = $string_iterator->has_prev();
Return true if the iterator is not at the start of the string.
next
my $code_point = $iter->next;
Return the code point after the current position and advance the iterator. Returns undef at the end of the string. Returns zero but true for U+0000.
prev
my $code_point = $iter->prev;
Return the code point before the current position and go one step back. Returns undef at the start of the string. Returns zero but true for U+0000.
advance
my $int = $string_iterator->advance($num);
Skip code points.
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.
recede
my $int = $string_iterator->recede($num);
Skip code points backward.
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.
skip_whitespace
my $int = $string_iterator->skip_whitespace();
Skip whitespace. Whitespace is any character that has the Unicode property
White_Space
.Returns: the number of code points skipped.
skip_whitespace_back
my $int = $string_iterator->skip_whitespace_back();
Skip whitespace backward. 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);
Test whether the content after the iterator starts with
prefix
.ends_with
my $bool = $string_iterator->ends_with($suffix);
Test whether the content before the iterator ends with
suffix
.INHERITANCE
Clownfish::StringIterator isa Clownfish::Obj.
Module Install Instructions
To install Clownfish, copy and paste the appropriate command in to your terminal.
cpanm Clownfish
perl -MCPAN -e shell install Clownfish
For more information on module installation, please visit the detailed CPAN module installation guide.