New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use replace instead of substr #1749
Comments
From @zhuomingliangFrom 42acea630546f1641ae6914c459da53036b4e8c0 Mon Sep 17 00:00:00 2001 src/builtins/Str.pir | 20 ++++---------------- Inline Patchdiff --git a/src/builtins/Str.pir b/src/builtins/Str.pir
index 7ba0230..2493b41 100644
--- a/src/builtins/Str.pir
+++ b/src/builtins/Str.pir
@@ -1,4 +1,4 @@
-=head1 TITLE
+=head1 TITLE
Str - Perl 6 Str class and related functions
@@ -155,11 +155,7 @@ Increment and Decrement Methods
dec_2:
dec ipos
repl = substr RANGES, ipos, 1
- $S0 = substr str, 0, r1
- $I0 = r1 + 1
- $S1 = substr str, $I0
- str = concat $S0, repl
- str = concat str, $S1
+ str = replace str, r1, 1, repl
# if the replacement wasn't a carry, we're done
if orig > repl goto done
carry:
@@ -190,11 +186,7 @@ Increment and Decrement Methods
inc ipos
.local string repl
repl = substr RANGES, ipos, 1
- $S0 = substr str, 0, r1
- $I0 = r1 + 1
- $S1 = substr str, $I0
- str = concat $S0, repl
- str = concat str, $S1
+ str = replace str, r1, 1, repl
# if the replacement wasn't a carry, we're done
if orig < repl goto done
carry:
@@ -206,11 +198,7 @@ Increment and Decrement Methods
unless repl == '0' goto extend_1
repl = '1'
extend_1:
- $S0 = substr str, 0, r0
- $S1 = substr str, r0
- str = concat $S0, repl
- str = concat str, $S1
-
+ str = replace str, r0, 0, repl
done:
.return (str)
.end
--
å�¨æ¤ç¥�ä½ èº«ä½�å�¥åº·ï¼�天天快ä¹�
|
From @zhuomingliang0001-use-replace-instead-of-substr.patchFrom 42acea630546f1641ae6914c459da53036b4e8c0 Mon Sep 17 00:00:00 2001
From: Jimmy Zhuo <zhuomingliang@yahoo.com.cn>
Date: Thu, 6 May 2010 15:51:19 +0800
Subject: use replace instead of substr
---
src/builtins/Str.pir | 20 ++++----------------
1 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/src/builtins/Str.pir b/src/builtins/Str.pir
index 7ba0230..2493b41 100644
--- a/src/builtins/Str.pir
+++ b/src/builtins/Str.pir
@@ -1,4 +1,4 @@
-=head1 TITLE
+���=head1 TITLE
Str - Perl 6 Str class and related functions
@@ -155,11 +155,7 @@ Increment and Decrement Methods
dec_2:
dec ipos
repl = substr RANGES, ipos, 1
- $S0 = substr str, 0, r1
- $I0 = r1 + 1
- $S1 = substr str, $I0
- str = concat $S0, repl
- str = concat str, $S1
+ str = replace str, r1, 1, repl
# if the replacement wasn't a carry, we're done
if orig > repl goto done
carry:
@@ -190,11 +186,7 @@ Increment and Decrement Methods
inc ipos
.local string repl
repl = substr RANGES, ipos, 1
- $S0 = substr str, 0, r1
- $I0 = r1 + 1
- $S1 = substr str, $I0
- str = concat $S0, repl
- str = concat str, $S1
+ str = replace str, r1, 1, repl
# if the replacement wasn't a carry, we're done
if orig < repl goto done
carry:
@@ -206,11 +198,7 @@ Increment and Decrement Methods
unless repl == '0' goto extend_1
repl = '1'
extend_1:
- $S0 = substr str, 0, r0
- $S1 = substr str, r0
- str = concat $S0, repl
- str = concat str, $S1
-
+ str = replace str, r0, 0, repl
done:
.return (str)
.end
--
1.6.4.msysgit.0
|
From @moritzApplied, thanks. |
@moritz - Status changed from 'new' to 'resolved' |
Migrated from rt.perl.org#74942 (status was 'resolved')
Searchable as RT74942$
The text was updated successfully, but these errors were encountered: