Determine if a string is collapsible: Difference between revisions
Content added Content deleted
m (→{{header|Factor}}: credit where credit's due) |
m (→{{header|zkl}}: tweak) |
||
Line 407: | Line 407: | ||
}</lang> |
}</lang> |
||
<lang zkl>strings:= |
<lang zkl>strings:= |
||
#<<< |
|||
0'^ |
0'^ |
||
"If I were two-faced, would I be wearing this one?" --- Abraham Lincoln |
"If I were two-faced, would I be wearing this one?" --- Abraham Lincoln |
||
Line 415: | Line 414: | ||
The American people have a right to know if their president is a crook. |
The American people have a right to know if their president is a crook. |
||
--- Richard Nixon |
--- Richard Nixon |
||
The better the 4-wheel drive, the further you'll be from help when ya get stuck! |
|||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA^ |
|||
headmistressship |
|||
aardvark^ |
|||
.split("\n"); |
.split("\n"); |
||
#<<< |
#<<< |
||
foreach s in (strings){ |
foreach s in (strings){ |
||
println(" |
println("Before: %3d >>>%s<<<".fmt(s.len(),s)); |
||
_,cstr:=collapsible(s); |
|||
println(" |
println("After: %3d >>>%s<<<\n".fmt(cstr.len(),cstr)); |
||
println("Length: %3d >>>%s<<<\n".fmt(cstr.len(),cstr)); |
|||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Before: 0 >>><<< |
|||
⚫ | |||
Collapsible: False |
|||
⚫ | |||
⚫ | |||
After: 70 >>>"If I were two-faced, would I be wearing this one?" - Abraham Lincoln <<< |
|||
⚫ | |||
⚫ | |||
Before: 72 >>>I never give 'em hell, I just tell the truth, and they think it's hell. <<< |
|||
⚫ | |||
Collapsible: True |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
Collapsible: True |
|||
⚫ | |||
Before: 72 >>>The American people have a right to know if their president is a crook. <<< |
|||
⚫ | |||
Collapsible: True |
|||
⚫ | |||
Before: 72 >>> --- Richard Nixon <<< |
|||
⚫ | |||
Collapsible: True |
|||
⚫ | |||
Before: 80 >>>The better the 4-wheel drive, the further you'll be from help when ya get stuck!<<< |
|||
After: 77 >>>The beter the 4-whel drive, the further you'l be from help when ya get stuck!<<< |
|||
Collapsible: True |
|||
⚫ | |||
Before: 16 >>>headmistressship<<< |
|||
⚫ | |||
After: 14 >>>headmistreship<<< |
|||
Collapsible: True |
|||
⚫ | |||
⚫ | |||
Length: 72 >>>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA<<< |
|||
After: 7 >>>ardvark<<< |
|||
Collapsible: True |
|||
⚫ | |||
</pre> |
</pre> |