Determine if a string is squeezable: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Minor tidy) |
(Added Easylang) |
||
Line 1,514: | Line 1,514: | ||
old: 16 <<<headmistressship>>> |
old: 16 <<<headmistressship>>> |
||
new: 14 <<<headmistreship>>></pre> |
new: 14 <<<headmistreship>>></pre> |
||
=={{header|EasyLang}}== |
|||
<syntaxhighlight> |
|||
func$ squeeze s$ x$ . |
|||
for c$ in strchars s$ |
|||
if c$ <> x$ or c$ <> cc$ |
|||
r$ &= c$ |
|||
. |
|||
cc$ = c$ |
|||
. |
|||
return r$ |
|||
. |
|||
proc do s$ x$ . . |
|||
print "'" & x$ & "'" |
|||
print "«««" & s$ & "»»» (" & len s$ & ")" |
|||
r$ = squeeze s$ x$ |
|||
print "«««" & r$ & "»»» (" & len r$ & ")" |
|||
print "" |
|||
. |
|||
do "" " " |
|||
do "\"If I were two-faced, would I be wearing this one?\" --- Abraham Lincoln " "-" |
|||
do "..1111111111111111111111111111111111111111111111111111111111111117777888" "7" |
|||
do "I never give 'em hell, I just tell the truth, and they think it's hell. " "." |
|||
do " --- Harry S Truman " " " |
|||
do " --- Harry S Truman " "-" |
|||
do " --- Harry S Truman " "r" |
|||
</syntaxhighlight> |
|||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |
||
Line 1,542: | Line 1,569: | ||
'r' squeezes <<< --- Harry S Truman >>> (length 72) to <<< --- Hary S Truman >>> (length 71) |
'r' squeezes <<< --- Harry S Truman >>> (length 72) to <<< --- Hary S Truman >>> (length 71) |
||
</pre> |
</pre> |
||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
<syntaxhighlight lang="factor">USING: formatting fry io kernel math sbufs sequences strings ; |
<syntaxhighlight lang="factor">USING: formatting fry io kernel math sbufs sequences strings ; |