Clownfish::String - Immutable string holding Unicode characters.
my $string = Clownfish::String->new('abc'); print $string->to_perl, "\n";
my $string = Clownfish::String->new($perl_string);
Return a String containing the passed-in Perl string.
my $result = $string->cat($other);
Return the concatenation of the String and other
.
my $int = $string->to_i64();
Extract a 64-bit integer from a decimal string. See basex_to_i64() for details.
my $int = $string->basex_to_i64($base);
Extract a 64-bit integer from a variable-base stringified version.
Expects an optional minus sign followed by base-x digits,
stopping at any non-digit character.
Returns zero if no digits are found.
If the value exceeds the range of an int64_t
,
the result is undefined.
my $float = $string->to_f64();
Convert a string to a floating-point number using the C library function strtod
.
my $bool = $string->starts_with($prefix);
Test whether the String starts with prefix
.
my $bool = $string->ends_with($suffix);
Test whether the String ends with suffix
.
my $bool = $string->contains($substring);
Test whether the String contains substring
.
my $string_iterator = $string->find($substring);
Return a StringIterator pointing to the first occurrence of substring
within the String,
or undef if the substring does not match.
my $int = $string->length();
Return the number of Unicode code points the String contains.
my $int = $string->get_size();
Return the number of bytes occupied by the String’s internal content.
my $byte_buf = $string->to_bytebuf();
Return a ByteBuf which holds a copy of the String.
my $result = $string->clone();
Return a clone of the object.
my $int = $string->compare_to($other);
Indicate whether one String is less than,
equal to,
or greater than another.
The Unicode code points of the Strings are compared lexicographically.
Throws an exception if other
is not a String.
Returns: 0 if the Strings are equal,
a negative number if self
is less than other
,
and a positive number if self
is greater than other
.
my $result = $string->trim();
Return a copy of the String with Unicode whitespace characters removed from both top and tail.
Whitespace is any character that has the Unicode property White_Space
.
my $result = $string->trim_top();
Return a copy of the String with leading Unicode whitespace removed.
Whitespace is any character that has the Unicode property White_Space
.
my $result = $string->trim_tail();
Return a copy of the String with trailing Unicode whitespace removed.
Whitespace is any character that has the Unicode property White_Space
.
my $int = $string->code_point_at($tick);
Return the Unicode code point located tick
code points in from the top.
Return CFISH_STR_OOB
if out of bounds.
my $int = $string->code_point_from($tick);
Return the Unicode code point located tick
code points counting backwards from the end.
Return CFISH_STR_OOB
if out of bounds.
my $result = $string->substring( offset => $offset # required length => $length # required );
Return a new substring containing a copy of the specified range.
my $string_iterator = $string->top();
Return an iterator initialized to the start of the string.
my $string_iterator = $string->tail();
Return an iterator initialized to the end of the string.
Clownfish::String isa 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.