Anonymous user
Determine if a string is collapsible: Difference between revisions
Determine if a string is collapsible (view source)
Revision as of 08:03, 29 April 2020
, 4 years agoBoolean expression was a shame.
(Added Wren) |
(Boolean expression was a shame.) |
||
Line 1,456:
=={{header|Scala}}==
===Pure imperative programming===
<lang Scala>
/**Collapse a string (if possible)*/
Line 1,477 ⟶ 1,478:
/**Check if a string is collapsible*/
def isCollapsible (s : String) : Boolean =
/**Display results as asked in the task*/
Line 1,510 ⟶ 1,511:
}</lang>▼
▲</lang>
{{out}}
<pre>ORIGINAL : length = 0, string = «««»»»▼
▲ORIGINAL : length = 0, string = «««»»»
COLLAPSED : length = 0, string = «««»»»
This string is NOT collapsible !
Line 1,545 ⟶ 1,543:
ORIGINAL : length = 8, string = «««aardvark»»»
COLLAPSED : length = 7, string = «««ardvark»»»
This string IS collapsible !</pre>
=={{header|Sidef}}==
|