Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
36
Task/Comma-quibbling/DCL/comma-quibbling.dcl
Normal file
36
Task/Comma-quibbling/DCL/comma-quibbling.dcl
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
$ list = "[]"
|
||||
$ gosub comma_quibbling
|
||||
$ write sys$output return_string
|
||||
$
|
||||
$ list = "[""ABC""]"
|
||||
$ gosub comma_quibbling
|
||||
$ write sys$output return_string
|
||||
$
|
||||
$ list = "[""ABC"", ""DEF""]"
|
||||
$ gosub comma_quibbling
|
||||
$ write sys$output return_string
|
||||
$
|
||||
$ list = "[""ABC"", ""DEF"", ""G"", ""H""]"
|
||||
$ gosub comma_quibbling
|
||||
$ write sys$output return_string
|
||||
$
|
||||
$ exit
|
||||
$
|
||||
$ comma_quibbling:
|
||||
$ list = list - "[" - "]"
|
||||
$ return_string = "{}"
|
||||
$ if list .eqs. "" then $ return
|
||||
$ return_string = "{" + f$element( 0, ",", list ) - """" - """"
|
||||
$ if f$locate( ",", list ) .eq. f$length( list ) then $ goto done2
|
||||
$ i = 1
|
||||
$ loop:
|
||||
$ word = f$element( i, ",", list ) - """" - """"
|
||||
$ if word .eqs. "," then $ goto done1
|
||||
$ return_string = return_string - "^" + "^," + word
|
||||
$ i = i + 1
|
||||
$ goto loop
|
||||
$ done1:
|
||||
$ return_string = f$element( 0, "^", return_string ) + " and" + ( f$element( 1, "^", return_string ) - "," )
|
||||
$ done2:
|
||||
$ return_string = return_string + "}"
|
||||
$ return
|
||||
Loading…
Add table
Add a link
Reference in a new issue