1Clownfish::StringIteratUosre(r3)Contributed Perl DocumenCtlaotwinofnish::StringIterator(3)
2
3
4

NAME

6       Clownfish::StringIterator - Iterate Unicode code points in a String.
7

SYNOPSIS

9           my $iter = $string->top;
10           while (my $code_point = $iter->next) {
11               ...
12           }
13

DESCRIPTION

METHODS

16   clone
17           my $result = $string_iterator->clone();
18
19       Return a clone of the object.
20
21   assign
22           $string_iterator->assign($other);
23
24       Assign the source string and current position of "other" to "self".
25
26   compare_to
27           my $int = $string_iterator->compare_to($other);
28
29       Indicate whether one StringIterator is less than, equal to, or greater
30       than another by comparing their character positions. Throws an
31       exception if "other" is not a StringIterator pointing to the same
32       source string as "self".
33
34       Returns: 0 if the StringIterators are equal, a negative number if
35       "self" is less than "other", and a positive number if "self" is greater
36       than "other".
37
38   has_next
39           my $bool = $string_iterator->has_next();
40
41       Return true if the iterator is not at the end of the string.
42
43   has_prev
44           my $bool = $string_iterator->has_prev();
45
46       Return true if the iterator is not at the start of the string.
47
48   next
49           my $code_point = $iter->next;
50
51       Return the code point after the current position and advance the
52       iterator. Returns undef at the end of the string. Returns zero but true
53       for U+0000.
54
55   prev
56           my $code_point = $iter->prev;
57
58       Return the code point before the current position and go one step back.
59       Returns undef at the start of the string. Returns zero but true for
60       U+0000.
61
62   advance
63           my $int = $string_iterator->advance($num);
64
65       Skip code points.
66
67       ·   num - The number of code points to skip.
68
69       Returns: the number of code points actually skipped. This can be less
70       than the requested number if the end of the string is reached.
71
72   recede
73           my $int = $string_iterator->recede($num);
74
75       Skip code points backward.
76
77       ·   num - The number of code points to skip.
78
79       Returns: the number of code points actually skipped. This can be less
80       than the requested number if the start of the string is reached.
81
82   skip_whitespace
83           my $int = $string_iterator->skip_whitespace();
84
85       Skip whitespace.  Whitespace is any character that has the Unicode
86       property "White_Space".
87
88       Returns: the number of code points skipped.
89
90   skip_whitespace_back
91           my $int = $string_iterator->skip_whitespace_back();
92
93       Skip whitespace backward.  Whitespace is any character that has the
94       Unicode property "White_Space".
95
96       Returns: the number of code points skipped.
97
98   starts_with
99           my $bool = $string_iterator->starts_with($prefix);
100
101       Test whether the content after the iterator starts with "prefix".
102
103   ends_with
104           my $bool = $string_iterator->ends_with($suffix);
105
106       Test whether the content before the iterator ends with "suffix".
107

INHERITANCE

109       Clownfish::StringIterator isa Clownfish::Obj.
110
111
112
113perl v5.30.1                      2020-01-29      Clownfish::StringIterator(3)
Impressum