Skip to content

Commit

Permalink
De-dups fmt and reflows, closes #2740
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed May 2, 2019
1 parent 424918a commit ab850be
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions doc/Type/Cool.pod6
Expand Up @@ -642,19 +642,25 @@ Defined as:
method fmt($format = '%s')
Equivalent to calling L<sprintf|/routine/sprintf> with C<$format> as format and
the invocant as the second argument. The C<$format> will be coerced to
Uses C<$format> to return a formatted representation of the invocant; equivalent
to calling L<sprintf|/routine/sprintf> with C<$format> as format and the
invocant as the second argument. The C<$format> will be coerced to
L<Stringy|/type/Stringy> and defaults to C<'%s'>.
For more information about formats strings, see L<sprintf|/routine/sprintf>.
say 11.fmt('This Int equals %03d'); # OUTPUT: «This Int equals 011␤»
say '16'.fmt('Hexadecimal %x'); # OUTPUT: «Hexadecimal 10␤»
=head2 routine ceiling
Defined as:
multi sub ceiling(Numeric(Cool))
multi method ceiling
Coerces the invocant (or in sub form, its argument) to L<Numeric|/type/Numeric>, and rounds it upwards to
the nearest integer.
Coerces the invocant (or in sub form, its argument) to L<Numeric|/type/Numeric>,
and rounds it upwards to the nearest integer.
say "1".ceiling; # OUTPUT: «1␤»
say "-0.9".ceiling; # OUTPUT: «0␤»
Expand All @@ -680,9 +686,9 @@ Defined as:
sub ord(Str(Cool))
method ord()
Coerces the invocant (or in sub form, its argument) to
L<Str|/type/Str>, and returns the L<Unicode code point|https://en.wikipedia.org/wiki/Code_point> number of the first
code point.
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and
returns the L<Unicode code point|https://en.wikipedia.org/wiki/Code_point>
number of the first code point.
say 'a'.ord; # OUTPUT: «97␤»
Expand Down Expand Up @@ -724,17 +730,22 @@ Mnemonic: turns an integer into a I<char>acter.
Defined as:
sub chars(Str(Cool))
method chars()
multi sub chars(Cool $x)
multi sub chars(Str:D $x)
multi sub chars(str $x --> int)
method chars(--> Int:D)
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and returns the
number of characters in the string. Please note that on the JVM, you currently get
codepoints instead of graphemes.
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and
returns the number of characters in the string. Please note that on the JVM, you
currently get codepoints instead of graphemes.
say 'møp'.chars; # OUTPUT: «3␤»
say 'ã̷̠̬̊'.chars; # OUTPUT: «1␤»
say '👨‍👩‍👧‍👦🏿'.chars; # OUTPUT: «1␤»
If the string is native, the number of chars will be also returned as a native
C<int>.
X<|Grapheme>
Graphemes are user visible characters. That is, this is what the user
Expand Down Expand Up @@ -764,8 +775,9 @@ Defined as:
sub codes(Str(Cool))
method codes()
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and returns the number of
L<Unicode code points|https://en.wikipedia.org/wiki/Code_point>.
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and
returns the number of L<Unicode code
points|https://en.wikipedia.org/wiki/Code_point>.
say 'møp'.codes; # OUTPUT: «3␤»
Expand All @@ -779,10 +791,11 @@ L<ords|/routine/ords> first obtains the actual codepoints, so there might be a d
Defined as:
sub flip(Str(Cool))
sub flip(Cool $s --> Str:D)
method flip()
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and returns a reversed version.
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and
returns a reversed version.
say 421.flip; # OUTPUT: «124␤»
Expand All @@ -793,8 +806,8 @@ Defined as:
sub trim(Str(Cool))
method trim()
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and returns the string with both
leading and trailing whitespace stripped.
Coerces the invocant (or in sub form, its argument) to L<Str|/type/Str>, and
returns the string with both leading and trailing whitespace stripped.
my $stripped = ' abc '.trim;
say "<$stripped>"; # OUTPUT: «<abc>␤»
Expand Down Expand Up @@ -1343,19 +1356,6 @@ Defined as:
Coerces the invocant to L<Str|/type/Str> and calls the method
L<match|/type/Str#method_match> on it.
=head2 method fmt
Defined as:
method fmt($format = '%s' --> Str:D)
Uses C<$format> to return a formatted representation of the invocant.
For more information about formats strings, see L<sprintf|/routine/sprintf>.
say 11.fmt('This Int equals %03d'); # OUTPUT: «This Int equals 011␤»
say '16'.fmt('Hexadecimal %x'); # OUTPUT: «Hexadecimal 10␤»
=head2 routine roots
Defined as:
Expand Down

0 comments on commit ab850be

Please sign in to comment.