September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -2,7 +2,7 @@
parse arg A B; LB=length(B) /*obtain A and B from the command line.*/
say 'string A = ' A /*display string A to the terminal.*/
say 'string B = ' B /* " " B " " " */
say
say copies('', 70)
if left(A, LB)==B then say 'string A starts with string B'
else say "string A doesn't start with string B"
say /* [↓] another method using COMPARE BIF*/
@ -17,12 +17,11 @@ say
if right(A, LB)==b then say 'string A ends with string B'
else say "string A doesn't end with string B"
say
$=; p=0; do until p==0; p=pos(B, A, p+1)
if p\==0 then $=$',' p
end /*until ···*/
$=space(strip($,'L',",")) /*elide extra blanks and leading comma.*/
#=words($)
$=; p=0; do until p==0; p=pos(B, A, p+1)
if p\==0 then $=$',' p
end /*until*/
$=space(strip($, 'L', ",")) /*elide extra blanks and leading comma.*/
#=words($) /*obtain number of words in $ string.*/
if #==0 then say "string A doesn't contain string B"
else say 'string A contains string B ' # " time"left('s', #>1),
"(at position"left('s', #>1) $")"
/*stick a fork in it, we're all done. */
else say 'string A contains string B ' # " time"left('s', #>1),
"(at position"left('s', #>1) $")" /*stick a fork in it, we're done*/