File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,15 @@ replace: func [
145
145
length? :search
146
146
]
147
147
binary? target [
148
- unless binary? :search [search: to-binary :search ] ; Must be convertable
148
+ unless binary? :search [ ; Must be convertable
149
+ if integer? :search [
150
+ if any [:search > 255 :search < 0 ] [
151
+ cause-error 'Script 'out-of-range :search
152
+ ]
153
+ search: to char! :search
154
+ ]
155
+ search: to binary! :search
156
+ ]
149
157
length? :search
150
158
]
151
159
any-block? :search [length? :search ]
Original file line number Diff line number Diff line change @@ -548,6 +548,13 @@ Rebol [
548
548
--assert 32 = take #{ 20 }
549
549
--assert 4 = take #{ 04 }
550
550
551
+ --test-- "REPLACE binary! integer! integer!"
552
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/2412
553
+ b: #{ 010201 }
554
+ --assert #{ 010301 } = replace b 2 3
555
+ --assert #{ 000300 } = replace/all b 1 0
556
+ --assert error? try [replace b 257 0 ]
557
+
551
558
--test-- "any-string? binary!"
552
559
;@@ https://github.com/Oldes/Rebol-issues/issues/820
553
560
--assert not any-string? #{}
You can’t perform that action at this time.
0 commit comments