parcel | Clownfish |
class variable | CFISH_STRINGITERATOR |
struct symbol | cfish_StringIterator |
class nickname | cfish_StrIter |
header file | Clownfish/String.h |
Clownfish::StringIterator – Iterate Unicode code points in a String.
cfish_String* // incremented
cfish_StrIter_crop(
cfish_StringIterator *top,
cfish_StringIterator *tail
);
Return the substring between the top and tail iterators.
Top iterator. Use start of string if NULL.
Tail iterator. Use end of string if NULL.
cfish_StringIterator* // incremented
cfish_StrIter_Clone(
cfish_StringIterator *self
);
Return a clone of the object.
void
cfish_StrIter_Assign(
cfish_StringIterator *self,
cfish_StringIterator *other
);
Assign the source string and current position of other
to self
.
bool
cfish_StrIter_Equals(
cfish_StringIterator *self,
cfish_Obj *other
);
Equality test.
Returns: true if other
is a StringIterator with the same source
string and character position as self
.
int32_t
cfish_StrIter_Compare_To(
cfish_StringIterator *self,
cfish_Obj *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 as self
.
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
.
bool
cfish_StrIter_Has_Next(
cfish_StringIterator *self
);
Return true if the iterator is not at the end of the string.
bool
cfish_StrIter_Has_Prev(
cfish_StringIterator *self
);
Return true if the iterator is not at the start of the string.
int32_t
cfish_StrIter_Next(
cfish_StringIterator *self
);
Return the code point after the current position and advance the
iterator. Return CFISH_STR_OOB
at the end of the string.
int32_t
cfish_StrIter_Prev(
cfish_StringIterator *self
);
Return the code point before the current position and go one step back.
Return CFISH_STR_OOB
at the start of the string.
size_t
cfish_StrIter_Advance(
cfish_StringIterator *self,
size_t num
);
Skip code points.
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.
size_t
cfish_StrIter_Recede(
cfish_StringIterator *self,
size_t num
);
Skip code points backward.
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.
size_t
cfish_StrIter_Skip_Whitespace(
cfish_StringIterator *self
);
Skip whitespace. Whitespace is any character that has the Unicode
property White_Space
.
Returns: the number of code points skipped.
size_t
cfish_StrIter_Skip_Whitespace_Back(
cfish_StringIterator *self
);
Skip whitespace backward. Whitespace is any character that has the
Unicode property White_Space
.
Returns: the number of code points skipped.
bool
cfish_StrIter_Starts_With(
cfish_StringIterator *self,
cfish_String *prefix
);
Test whether the content after the iterator starts with prefix
.
bool
cfish_StrIter_Starts_With_Utf8(
cfish_StringIterator *self,
char *utf8,
size_t size
);
Test whether the content after the iterator starts with a prefix supplied as raw UTF-8.
Pointer to UTF-8 character data.
Size of UTF-8 character data in bytes.
bool
cfish_StrIter_Ends_With(
cfish_StringIterator *self,
cfish_String *suffix
);
Test whether the content before the iterator ends with suffix
.
bool
cfish_StrIter_Ends_With_Utf8(
cfish_StringIterator *self,
char *utf8,
size_t size
);
Test whether the content before the iterator ends with a suffix supplied as raw UTF-8.
Pointer to UTF-8 character data.
Size of UTF-8 character data in bytes.
Clownfish::StringIterator is a Clownfish::Obj.
Copyright © 2010-2015 The Apache Software Foundation, Licensed under the
Apache License, Version 2.0.
Apache Lucy, Lucy, Apache, the Apache feather logo, and the Apache Lucy project logo are trademarks of The
Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their
respective owners.