develooper Front page | perl.perl6.internals | Postings from July 2002

[PATCH] 3-arg chopn

Thread Next
From:
brian wheeler
Date:
July 2, 2002 12:43
Subject:
[PATCH] 3-arg chopn
Message ID:
1025638674.17095.2.camel@thor
I saw this was a TODO item in core.ops.

Brian



--- core.ops	1 Jul 2002 17:18:04 -0000	1.176
+++ core.ops	2 Jul 2002 19:41:44 -0000
@@ -2074,9 +2074,9 @@
 
 =item B<chopn>(inout STR, in INT)
 
-Remove $2 characters from the end of the string in $1.
+=item B<chopn>(out STR, in STR, in INT)
 
-TODO: Create a three-argument version of this? Don't force in-place modification.'
+Remove $2 characters from the end of the string in $1.
 
 =cut
 
@@ -2085,6 +2085,11 @@
   goto NEXT();
 }
 
+inline op chopn(out STR, in STR, in INT) {
+  $1 = string_copy(interpreter, $2);
+  (void)string_chopn($1,$3);
+  goto NEXT();
+}
 
 ########################################


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About