@@ -290,19 +290,20 @@ C<Hash>.
290
290
291
291
= head2 Numeric Codepoint
292
292
293
- ord(Str $char) --> Int
294
- ords(Str $string) --> Array[Int]
293
+ ord(Stringy $char) --> Int
294
+ ords(Stringy $string) --> Array[Int]
295
295
296
- Str.ord() --> Int
297
- Str.ords() --> Array[Int]
296
+ Stringy.ord() --> Int
297
+
298
+ Stringy.ords() --> Array[Int]
298
299
299
- The C < &ord > function (and corresponding C < Str.ord > method) return the codepoint
300
- number of the first codepoint of the string. The C < &ords > function and method
301
- returns an C < Array > of codepoint numbers for every codepoint in the string.
300
+ The C < &ord > function (and corresponding C < Stringy.ord > method) return the
301
+ codepoint number of the first codepoint of the string. The C < &ords > function and
302
+ method returns an C < Array > of codepoint numbers for every codepoint in the
303
+ string.
302
304
303
- [Conjecture: should there be a C < :raw > adverb or C < &raword > function that allows
304
- you to access NFG codepoints, i.e. get negative numbers? Seems useless given how
305
- those numbers work, but you never know...]
305
+ This works on any type that does the C < Stringy > role. Note that using this on
306
+ type C < Str > may return invalid negative numbers as "codepoints".
306
307
307
308
= head2 Character Representation
308
309
@@ -321,7 +322,11 @@ encoded codepoints).
321
322
322
323
An error will occur if the C < Str > generated by these functions contains an
323
324
invalid character or sequence of characters. This includes, but is not limited
324
- to, codepoint values greater than C < 0x10FFFF > and parts of surrogate code pairs.
325
+ to, codepoint values greater than C < 0x10FFFF > and parts of surrogate code pairs,
326
+ and negative numbers.
327
+
328
+ The ability to convert negative number codepoints (i.e. C < Str.ords > ) is not
329
+ guaranteed and therefore currently disallowed.
325
330
326
331
= head2 Character Name
327
332
0 commit comments