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.
o<angle>
<angle>
o
o<angle>o
<*>o<angle><angle>
<angle>
<integral>
<*>
_
<*><**>o
o<angle> <angle>
o<angle>o<angle> <*> <*>
<*> o<angle>o
<*>
<*> <permille><permille>
<*> o
<*>
<*>
<*>
<*>
<*>
<*>
'
<*>
<permille><*>
<permille><*>
<*>
<*>
<*>
<*><*> <*><*> <*><*> <*><*> <*><*> <*> <*><*> <*><*>
<*><*> <*><*> <*><*>
<*><*> <*><*_ <*><permille> <*> <*><*><*><*><*><*><*><*><*><*><*><*> <*>
<*><*><*><*> <permille> <permille> <*> <*><*>
<*><*> <*> <*> <*> <*> <*><*>-~ <*><*> <*><*><permille> <*><*> <*><*>
<*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*><*> <*><*><*><*> <*><*> <*>
<*> <*><*>
<*><*>
<*><*> <*><*> <*><*>
<*><*> <*><*> <*><*>-~
<*><*> <*>-~ <*> <*><*> <*><*>
perl v5.34.0 2022-02-06 String(3pm)
Generated by $Id: phpMan.php,v 4.55 2007/09/05 04:42:51 chedong Exp $ Author: Che Dong
On Apache
Under GNU General Public License
2025-11-22 19:21 @216.73.216.63 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)