String(3pm) User Contributed Perl Documentation String(3pm)
NAME
Unicode::String - String of Unicode characters (UTF-16BE)
SYNOPSIS
use Unicode::String qw(utf8 latin1 utf16be);
$u = utf8("string");
$u = latin1("string");
$u = utf16be("\0s\0t\0r\0i\0n\0g");
print $u->utf32be; # 4 byte characters
print $u->utf16le; # 2 byte characters + surrogates
print $u->utf8; # 1-4 byte characters
DESCRIPTION
A "Unicode::String" object represents a sequence of Unicode characters.
Methods are provided to convert between various external formats
(encodings) and "Unicode::String" objects, and methods are provided for
common string manipulations.
The functions utf32be(), utf32le(), utf16be(), utf16le(), utf8(),
utf7(), latin1(), uhex(), uchr() can be imported from the
"Unicode::String" module and will work as constructors initializing
strings of the corresponding encoding.
The "Unicode::String" objects overload various operators, which means
that they in most cases can be treated like plain strings.
Internally a "Unicode::String" object is represented by a string of 2
byte numbers in network byte order (big-endian). This representation is
not visible by the API provided, but it might be useful to know in
order to predict the efficiency of the provided methods.
METHODS
Class methods
The following class methods are available:
Unicode::String->stringify_as
Unicode::String->stringify_as( $enc )
This method is used to specify which encoding will be used when
"Unicode::String" objects are implicitly converted to and from
plain strings.
If an argument is provided it sets the current encoding. The
argument should have one of the following: "ucs4", "utf32",
"utf32be", "utf32le", "ucs2", "utf16", "utf16be", "utf16le",
"utf8", "utf7", "latin1" or "hex". The default is "utf8".
The stringify_as() method returns a reference to the current
encoding function.
$us = Unicode::String->new
$us = Unicode::String->new( $initial_value )
This is the object constructor. Without argument, it creates an
empty "Unicode::String" object. If an $initial_value argument is
given, it is decoded according to the specified stringify_as()
encoding, UTF-8 by default.
In general it is recommended to import and use one of the encoding
specific constructor functions instead of invoking this method.
Encoding methods
These methods get or set the value of the "Unicode::String" object by
passing strings in the corresponding encoding. If a new value is
passed as argument it will set the value of the "Unicode::String", and
the previous value is returned. If no argument is passed then the
current value is returned.
String(3pm) User Contributed Perl Documentation String(3pm)
NAME
Unicode::String - String of Unicode characters (UTF-16BE)
SYNOPSIS
use Unicode::String qw(utf8 latin1 utf16be);
$u = utf8("string");
$u = latin1("string");
$u = utf16be("\0s\0t\0r\0i\0n\0g");
print $u->utf32be; # 4 byte characters
print $u->utf16le; # 2 byte characters + surrogates
print $u->utf8; # 1-4 byte characters
DESCRIPTION
A "Unicode::String" object represents a sequence of Unicode characters.
Methods are provided to convert between various external formats
(encodings) and "Unicode::String" objects, and methods are provided for
common string manipulations.
The functions utf32be(), utf32le(), utf16be(), utf16le(), utf8(),
utf7(), latin1(), uhex(), uchr() can be imported from the
"Unicode::String" module and will work as constructors initializing
strings of the corresponding encoding.
The "Unicode::String" objects overload various operators, which means
that they in most cases can be treated like plain strings.
Internally a "Unicode::String" object is represented by a string of 2
byte numbers in network byte order (big-endian). This representation is
not visible by the API provided, but it might be useful to know in
order to predict the efficiency of the provided methods.
METHODS
Class methods
The following class methods are available:
Unicode::String->stringify_as
Unicode::String->stringify_as( $enc )
This method is used to specify which encoding will be used when
"Unicode::String" objects are implicitly converted to and from
plain strings.
If an argument is provided it sets the current encoding. The
argument should have one of the following: "ucs4", "utf32",
"utf32be", "utf32le", "ucs2", "utf16", "utf16be", "utf16le",
"utf8", "utf7", "latin1" or "hex". The default is "utf8".
The stringify_as() method returns a reference to the current
encoding function.
$us = Unicode::String->new
$us = Unicode::String->new( $initial_value )
This is the object constructor. Without argument, it creates an
empty "Unicode::String" object. If an $initial_value argument is
given, it is decoded according to the specified stringify_as()
encoding, UTF-8 by default.
In general it is recommended to import and use one of the encoding
specific constructor functions instead of invoking this method.
Encoding methods
These methods get or set the value of the "Unicode::String" object by
passing strings in the corresponding encoding. If a new value is
passed as argument it will set the value of the "Unicode::String", and
the previous value is returned. If no argument is passed then the
current value is returned.
perl v5.32.0 2020-11-09 String(3pm)
Czas wygenerowania: 0.00031 sek.
Created with the man page lookup class by Andrew Collington.
Based on a C man page viewer by Vadim Pavlov
Unicode soft-hyphen fix (as used by RedHat) by Dan Edwards
Some optimisations by Eli Argon
Caching idea and code contribution by James Richardson
Copyright © 2003-2025 Linux.pl
Hosted by Hosting Linux.pl