Changeset 19424 for docs/Perl6/Spec

Show
Ignore:
Timestamp:
01/11/08 01:45:38 (11 months ago)
Author:
lwall
Message:

Defined .bytes, .codes, .graphs, and .chars
Defined samecase and samebase

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • docs/Perl6/Spec/Functions.pod

    r19300 r19424  
    1313                Mark Stosberg <mark@summersault.com> 
    1414 Date:          12 Mar 2005 
    15  Last Modified: 1 Jan 2008 
    16  Version:       15 
     15 Last Modified: 10 Jan 2008 
     16 Version:       16 
    1717 
    1818This document attempts to document the list of builtin functions in Perl 6. 
     
    11131113until there is no further work to be done. 
    11141114 
     1115=item samecase 
     1116 
     1117 our Str multi method samecase ( Str $string: Str $pattern ) is export 
     1118 
     1119Has the effect of making the case of the string match the case pattern in C<$pattern>. 
     1120(Used by s:ii/// internally, see L<S05>.) 
     1121 
     1122=item samebase 
     1123 
     1124 our Str multi method samebase ( Str $string: Str $pattern ) is export 
     1125 
     1126Has the effect of making the case of the string match the accent pattern in C<$pattern>. 
     1127(Used by s:bb/// internally, see L<S05>.) 
     1128 
    11151129=item capitalize 
    11161130 
     
    11241138 
    11251139This word is banned in Perl 6.  You must specify units. 
     1140 
     1141=item chars 
     1142 
     1143 our Int multi method chars ( Str $string: ) is export 
     1144 
     1145Returns the number of characters in the string in the current 
     1146(lexically scoped) idea of what a normal character is, usually graphemes. 
     1147 
     1148=item graphs 
     1149 
     1150 our Int multi method codes ( Str $string: ) is export 
     1151 
     1152Returns the number of graphemes in the string in a language-independent way. 
     1153 
     1154=item codes 
     1155 
     1156 our Int multi method codes ( Str $string: $nf = "C") is export 
     1157 
     1158Returns the number of codepoints in the string if it were canonicalized the 
     1159specified way.  Do not confuse codepoints with UTF-16 encoding.  Characters 
     1160above U+FFFF count as a single codepoint. 
     1161 
     1162=item bytes 
     1163 
     1164 our Int multi method bytes ( Str $string: $nf = "C", $enc = "UTF-8") is export 
     1165 
     1166Returns the number of bytes in the string if it were encoded in the 
     1167specified way.  Note the inequality: 
     1168 
     1169    .bytes("C","UTF-16") * 2 >= .codes("C") 
     1170 
     1171This is caused by the possibility of surrogate pairs, which are counted as one 
     1172codepoint.  However, this problem does not arise for UTF-32: 
     1173 
     1174    .bytes("C","UTF-32") * 4 == .codes("C") 
    11261175 
    11271176=item index