add s:index-of-string

FossilOrigin-Name: 4f06dda1a7ea4539aac4c61d5c0a2ef37bcc1f5234a85f27094ae4a91186c5b0
This commit is contained in:
crc 2017-11-09 13:58:18 +00:00
parent 4d6126e9e0
commit 82bb939250
3 changed files with 10 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -860,6 +860,7 @@ substring is in a string.
'Pad var
'I var
'F var
'At var
:terminate (-)
#0 @Pad @Tar s:length + store ;
@ -868,7 +869,7 @@ substring is in a string.
@Src @I + @Pad @Tar s:length copy ;
:compare (-)
@Pad @Tar s:eq? @F or !F ;
@Pad @Tar s:eq? @F or !F @F [ @I !At ] -if ;
:next (-)
&I v:inc ;
@ -878,6 +879,12 @@ substring is in a string.
@Src s:length
[ extract terminate compare next ] times
@F ;
:s:index-of-string (ss-a)
!Tar !Src s:empty !Pad #0 !I #0 !F #-1 !At
@Src s:length
[ extract terminate compare next ] times
@F [ @At ] [ #-1 ] choose ;
}}
~~~

BIN
ngaImage

Binary file not shown.