Anonymous user
String matching: Difference between revisions
m
→{{header|REXX}}: added DO-end label, indented DO loop. -- ~~~~
m (→{{header|REXX}}: added DO-end label, indented DO loop. -- ~~~~) |
|||
Line 1,296:
=={{header|REXX}}==
Extra coding was added to take of using plurals in the messages.
<lang rexx>/*REXX program to show some basic character string testing. */▼
▲/*REXX program to show some basic character string testing. */
parse arg a b
say 'string A=' a
say 'string B=' b
Line 1,320 ⟶ 1,318:
Ps=''
p=0
do forever until p==0
if p\==0 then Ps=Ps',' p▼
end /*forever*/
▲ if p\==0 then Ps=Ps',' p
Ps=space(strip(Ps,'L',","))
Line 1,331 ⟶ 1,328:
times 'time'left('s',times>1),
"(at position"left('s',times>1) Ps')'
else say "string A doesn't contains string B"</lang>
▲Output when the following is specified (five Marx brothers):
<br><br>
Chico_Harpo_Groucho_Zeppo_Gummo p
Line 1,348 ⟶ 1,344:
string A contains string B 3 times (at positions 10, 23, 24)
</pre>
<br><br>
Chico_Harpo_Groucho_Zeppo_Gummo Z
Line 1,363 ⟶ 1,359:
string A contains string B 1 time (at position 21)
</pre>
<br><br>
Chico_Harpo_Groucho_Zeppo_Gummo Chi
Line 1,378 ⟶ 1,374:
string A contains string B 1 time (at position 1)
</pre>
<br><br>
Chico_Harpo_Groucho_Zeppo_Gummo mmo
|