Eutf2 - Run-time routines for UTF2.pm
use Eutf2; Eutf2::split(...); Eutf2::tr(...); Eutf2::chop(...); Eutf2::index(...); Eutf2::rindex(...); Eutf2::capture(...); Eutf2::chr(...); Eutf2::chr_; Eutf2::glob(...); Eutf2::glob_; # "no Eutf2;" not supported
This module is a run-time routines of the UTF2.pm. Because the UTF2.pm automatically uses this module, you need not use directly.
Please patches and report problems to author are welcome.
This Eutf2 module first appeared in ActivePerl Build 522 Built under MSWin32 Compiled at Nov 2 1999 09:52:28
INABA Hitoshi <ina@cpan.org>
This project was originated by INABA Hitoshi. For any questions, use <ina@cpan.org> so we can share this file.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@split = Eutf2::split(/pattern/,$string,$limit); @split = Eutf2::split(/pattern/,$string); @split = Eutf2::split(/pattern/); @split = Eutf2::split('',$string,$limit); @split = Eutf2::split('',$string); @split = Eutf2::split(''); @split = Eutf2::split(); @split = Eutf2::split; Scans a UTF-2 $string for delimiters that match pattern and splits the UTF-2 $string into a list of substrings, returning the resulting list value in list context, or the count of substrings in scalar context. The delimiters are determined by repeated pattern matching, using the regular expression given in pattern, so the delimiters may be of any size and need not be the same UTF-2 $string on every match. If the pattern doesn't match at all, Eutf2::split returns the original UTF-2 $string as a single substring. If it matches once, you get two substrings, and so on. If $limit is specified and is not negative, the function splits into no more than that many fields. If $limit is negative, it is treated as if an arbitrarily large $limit has been specified. If $limit is omitted, trailing null fields are stripped from the result (which potential users of pop would do well to remember). If UTF-2 $string is omitted, the function splits the $_ UTF-2 string. If $patten is also omitted, the function splits on whitespace, /\s+/, after skipping any leading whitespace. If the pattern contains parentheses, then the substring matched by each pair of parentheses is included in the resulting list, interspersed with the fields that are ordinarily returned.
$tr = Eutf2::tr($variable,$bind_operator,$searchlist,$replacementlist,$modifier); $tr = Eutf2::tr($variable,$bind_operator,$searchlist,$replacementlist); This function scans a UTF-2 string character by character and replaces all occurrences of the characters found in $searchlist with the corresponding character in $replacementlist. It returns the number of characters replaced or deleted. If no UTF-2 string is specified via =~ operator, the $_ variable is translated. $modifier are: Modifier Meaning ------------------------------------------------------ c Complement $searchlist d Delete found but unreplaced characters s Squash duplicate replaced characters ------------------------------------------------------
$chop = Eutf2::chop(@list); $chop = Eutf2::chop(); $chop = Eutf2::chop; Chops off the last character of a UTF-2 string contained in the variable (or UTF-2 strings in each element of a @list) and returns the character chopped. The Eutf2::chop operator is used primarily to remove the newline from the end of an input record but is more efficient than s/\n$//. If no argument is given, the function chops the $_ variable.
$pos = Eutf2::index($string,$substr,$position); $pos = Eutf2::index($string,$substr); Returns the position of the first occurrence of $substr in UTF-2 $string. The start, if specified, specifies the $position to start looking in the UTF-2 $string. Positions are integer numbers based at 0. If the substring is not found, the Eutf2::index function returns -1.
$pos = Eutf2::rindex($string,$substr,$position); $pos = Eutf2::rindex($string,$substr); Works just like Eutf2::index except that it returns the position of the last occurence of $substr in UTF-2 $string (a reverse index). The function returns -1 if not found. $position, if specified, is the rightmost position that may be returned, i.e., how far in the UTF-2 string the function can search.
$capturenumber = Eutf2::capture($string); This function is internal use to m/ /, s/ / /, split / / and qr/ /.
$chr = Eutf2::chr($code); $chr = Eutf2::chr_; This function returns the character represented by that $code in the character set. For example, Eutf2::chr(65) is "A" in either ASCII or UTF-2, not Unicode, and Eutf2::chr(0x82a0) is a UTF-2 HIRAGANA LETTER A. For the reverse of Eutf2::chr, use UTF2::ord.
@glob = Eutf2::glob($string); @glob = Eutf2::glob_; Performs filename expansion (DOS-like globbing) on $string, returning the next successive name on each call. If $string is omitted, $_ is globbed instead. This function function when the pathname ends with chr(0x5C) on MSWin32. For example, C<<..\\l*b\\file/*glob.p?>> on MSWin32 or UNIX will work as expected (in that it will find something like '..\lib\File/DosGlob.pm' alright). Note that all path components are case-insensitive, and that backslashes and forward slashes are both accepted, and preserved. You may have to double the backslashes if you are putting them in literally, due to double-quotish parsing of the pattern by perl. A tilde ("~") expands to the current user's home directory. Spaces in the argument delimit distinct patterns, so C<glob('*.exe *.dll')> globs all filenames that end in C<.exe> or C<.dll>. If you want to put in literal spaces in the glob pattern, you can escape them with either double quotes. e.g. C<glob('c:/"Program Files"/*/*.dll')>.
1 POD Error
The following errors were encountered while parsing the POD:
=over without closing =back
To install Char::UTF2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Char::UTF2
CPAN shell
perl -MCPAN -e shell install Char::UTF2
For more information on module installation, please visit the detailed CPAN module installation guide.