fix s:replace-all

FossilOrigin-Name: 32e7c4592050bac1a96620be70a4d88b28dde7c5f273056e482b09ba6ce6f782
This commit is contained in:
crc 2022-03-02 11:23:09 +00:00
parent 02d6e49694
commit 1cefe4e333
3 changed files with 708 additions and 709 deletions

View file

@ -1263,25 +1263,7 @@ returns an array containing pointers to each of them.
#0 !TP
[ dup &Needle s:copy s:append ] [ s:length !Len ] bi
[ &Needle s:split/string save next done? ] until
&Tokens @TP n:dec !Tokens ;
}}
~~~
~~~
{{
:for-each (aq-)
swap fetch-next &swap dip
[ push fetch-next \swpodupu \swpuca.. \popo.... ] times drop-pair ;
:substitute STRINGS #129 - ;
:extract substitute s:copy ;
:tokenize s:tokenize-on-string s:empty ;
:combine substitute s:append s:append ;
:merge swap &combine for-each nip ;
:find-end dup s:length substitute s:length - over + ;
:clean find-end #0 swap store ;
---reveal---
:s:replace-all (sss-s)
&Heap [ extract tokenize merge clean s:temp ] v:preserve ;
&Tokens @TP n:dec !Tokens nip ;
}}
~~~
@ -1694,6 +1676,20 @@ different array.
&Heap [ dup a:length &swap dip a:right a:eq? ] v:preserve ;
~~~
~~~
{{
'Substitute d:create #128 allot
:extract &Substitute s:copy ;
:combine &Substitute s:append s:append ;
:find-end dup s:length &Substitute s:length - over + ;
:clean find-end #0 swap store ;
---reveal---
:s:replace-all (sss-s)
&Heap [ extract s:tokenize-on-string s:empty swap
[ combine ] a:for-each clean ] v:preserve ;
}}
~~~
## Evaluating Source
The standard interfaces have their own approaches to getting

BIN
ngaImage

Binary file not shown.

File diff suppressed because it is too large Load diff