# New Ticket Created by Vasily Chekalkin
# Please include the string: [perl #56208]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56208 >
Hello.
There is implementation of sprintf. Only src/classes/Str.pir affected.
BTW, '%p' works in parrot, but according to S29 shouldn't.
--
Bacek.
diff --git a/languages/perl6/src/classes/Str.pir b/languages/perl6/src/classes/Str.pir
index 0bd0d95..6195989 100644
--- a/languages/perl6/src/classes/Str.pir
+++ b/languages/perl6/src/classes/Str.pir
@@ -213,6 +213,14 @@ as the Perl 6 C<Str> class.
.return(retv)
.end
+.sub 'sprintf' :method
+ .param pmc args :slurpy
+ .local pmc retv
+
+ retv = new 'Perl6Str'
+ retv = sprintf self, args
+ .return (retv)
+.end
=item perl()
@@ -427,6 +435,23 @@ Returns string with one Char removed from the end.
.return s.'chop'()
.end
+=item sprintf
+
+ our Str multi method sprintf ( Str $format: [EMAIL PROTECTED] ) is export
+
+This function is mostly identical to the C library sprintf function.
+
+=cut
+
+.sub 'sprintf'
+ .param pmc format
+ .param pmc args :slurpy
+ .local pmc s
+ s = new 'Perl6Str'
+ s = format
+ .return s.'sprintf'(args :flat)
+.end
+
=back
=head2 TODO Functions
@@ -480,8 +505,6 @@ Needs to be in terms of StrPos, not Int.
Needs to be in terms of StrPos, not Int.
-=item sprintf
-
=item unpack
=item vec