Strings stored as Str are sequences of characters, independent of character encoding. The Buf type is available for storing binary data. The encode method converts a Str to Buf. decode goes the other direction.

The following operations are available for strings:

Таблица 11.4. Binary string operators

~concatenation: 'a' ~ 'b' is 'ab'
xreplication: 'a' x 2 is 'aa'

Таблица 11.5. Unary string operators

~conversion to string: ~1 becomes '1'

Таблица 11.6. String methods/functions

.chompremove trailing newline
.substr($start, $length)extract a part of the string. $length defaults to the rest of the string
.charsnumber of characters in the string
.ucupper case
.lclower case
.ucfirstconvert first character to upper case
.lcfirstconvert first character to lower case
.capitalizeconvert the first character of each word to upper case, and all other characters to lower case