1Clownfish::CharBuf(3) User Contributed Perl DocumentationClownfish::CharBuf(3)
2
3
4
6 Clownfish::CharBuf - Growable buffer holding Unicode characters.
7
9 my $buf = Clownfish::CharBuf->new;
10 $buf->cat('abc');
11 $buf->cat_char(ord("\n"));
12 print $buf->to_string;
13
16 new
17 my $char_buf = Clownfish::CharBuf->new(
18 capacity => $capacity, # default: 0
19 );
20
21 Return a new CharBuf.
22
23 • capacity - Initial minimum capacity of the CharBuf, in bytes.
24
26 cat
27 $char_buf->cat($string);
28
29 Concatenate the contents of String "string" onto the end of the caller.
30
31 • string - The String to concatenate.
32
33 cat_char
34 $char_buf->cat_char($code_point);
35
36 Concatenate one Unicode character onto the end of the CharBuf.
37
38 • code_point - The code point of the Unicode character.
39
40 grow
41 $char_buf->grow($capacity);
42
43 Assign more memory to the CharBuf, if it doesnXt already have enough
44 room to hold a string of "size" bytes. Cannot shrink the allocation.
45
46 • capacity - The new minimum capacity of the ByteBuf.
47
48 clear
49 $char_buf->clear();
50
51 Clear the CharBuf.
52
53 get_size
54 my $int = $char_buf->get_size();
55
56 Return the size of the CharBufXs content in bytes.
57
58 clone
59 my $result = $char_buf->clone();
60
61 Return a clone of the object.
62
63 yield_string
64 my $string = $char_buf->yield_string();
65
66 Return the content of the CharBuf as String and clear the CharBuf.
67 This is more efficient than to_string().
68
70 Clownfish::CharBuf isa Clownfish::Obj.
71
72
73
74perl v5.36.0 2022-07-22 Clownfish::CharBuf(3)