Clownf...:String(3pm)

πŸ“¦
version 0.8.0 Β· 3 versions
, in fedora 43, fedora 44

✨ NAME ✨

Clownfish::String β€” the immaculate, untouchable, never-changing string that holds Unicode characters. πŸ’–

It's giving immutable. Like, you literally cannot change her. Periodt.


🌸 SYNOPSIS 🌸

my $string = Clownfish::String->new('abc');
print $string->to_perl, "\n";

πŸ¦‹ DESCRIPTION πŸ¦‹

okay bestie, no preamble, we're going straight to the good stuff 🫢

πŸ’… CONSTRUCTORS πŸ’…

new

my $string = Clownfish::String->new($perl_string);

Hand her a Perl string, get a String back that's holding it. That's it. That's the whole vibe check. ✨


πŸŽ€ METHODS πŸŽ€

cat

my $result = $string->cat($other);

Glues the String and other together and returns the result. The two of them, combined, iconic. πŸ”₯

to_i64

my $int = $string->to_i64();

Pulls a 64-bit integer out of a decimal string. The deets live in basex_to_i64() β€” go look there. πŸ‘‘

basex_to_i64

my $int = $string->basex_to_i64($base);

Extracts a 64-bit integer from a variable-base stringified version. She expects an optional minus sign followed by base-x digits, and she stops dead at any non-digit character. If no digits are found at all, you get zero. πŸ’€

Careful bestie: if the value goes past the range of an int64_t, the result is undefined. Not "wrong", not "clamped" β€” undefined. Do not test her. 😭
  • base β€” a base between 2 and 36.

to_f64

my $float = $string->to_f64();

Turns a string into a floating-point number, using the C library function strtod. Classic. 🌈

starts_with

my $bool = $string->starts_with($prefix);

Checks whether the String starts with prefix. Yes or no, no in-between. πŸ’œ

ends_with

my $bool = $string->ends_with($suffix);

Checks whether the String ends with suffix. πŸŽ€

contains

my $bool = $string->contains($substring);

Checks whether the String contains substring. Somewhere. Anywhere. πŸ¦‹

find

my $string_iterator = $string->find($substring);

Returns a StringIterator pointing at the first occurrence of substring inside the String, or undef if the substring doesn't match anything. No match, no iterator, no drama. ✨

length

my $int = $string->length();

The number of Unicode code points the String contains. Code points, not bytes β€” she's counting the real ones. πŸ‘‘

get_size

my $int = $string->get_size();

The number of bytes occupied by the String's internal content. Different number, different question, don't mix them up. πŸ’…

to_bytebuf

my $byte_buf = $string->to_bytebuf();

Returns a ByteBuf holding a copy of the String. A whole new container, same contents. 🫢

clone

my $result = $string->clone();

Returns a clone of the object. A twin. A copy. Main character energy, duplicated. πŸ’–

compare_to

my $int = $string->compare_to($other);

Tells you whether one String is less than, equal to, or greater than another. The Unicode code points get compared lexicographically. And if other is not a String? She throws an exception. Do not come to her with the wrong type. 😭

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.

trim

my $result = $string->trim();

Returns a copy of the String with Unicode whitespace characters removed from both top and tail. "Whitespace" here means any character that has the Unicode property White_Space. Glow-up, both ends. ✨

trim_top

my $result = $string->trim_top();

Returns a copy of the String with the leading Unicode whitespace removed. Whitespace is any character that has the Unicode property White_Space. πŸŽ€

trim_tail

my $result = $string->trim_tail();

Returns a copy of the String with the trailing Unicode whitespace removed. Whitespace is any character that has the Unicode property White_Space. πŸ¦‹

code_point_at

my $int = $string->code_point_at($tick);

Returns the Unicode code point located tick code points in from the top. If you're out of bounds, you get CFISH_STR_OOB. That's the boundary, bestie. 🚧

code_point_from

my $int = $string->code_point_from($tick);

Returns the Unicode code point located tick code points counting backwards from the end. Out of bounds? CFISH_STR_OOB. Same rules, opposite direction. πŸ’œ

substring

my $result = $string->substring(
    offset => $offset,  # required
    length => $length,  # required
);

Returns a new substring containing a copy of the specified range.

  • offset β€” offset from the top, in code points.
  • length β€” the desired length of the substring, in code points.

Both required. She's not guessing what you meant. 🌸

top

my $string_iterator = $string->top();

Returns an iterator initialized to the start of the string. Fresh from the top, as the name says. ⭐

tail

my $string_iterator = $string->tail();

Returns an iterator initialized to the end of the string. Right at the tail end. πŸ“


πŸ‘‘ INHERITANCE πŸ‘‘

Clownfish::String isa Clownfish::Obj. Family tree, established. 🧚


that's the whole page bestie, every flag and every method accounted for, no cap πŸ’– this was the Clownf...:String(3pm) page from the User Contributed Perl Documentation, version perl v5.42.3, dated 2026-09-02 β€” slay, go write some strings πŸŽ€βœ¨πŸ’…

πŸ“¦ where this page comes from