17 lines
522 B
Plaintext
17 lines
522 B
Plaintext
|
/* output: 1 */
|
||
|
let
|
||
|
function indentstring (text : string, indent : string) : string =
|
||
|
let var out := indent
|
||
|
var newline_and_indent := concat("\n", indent)
|
||
|
var char := ""
|
||
|
in for i := 0 to size(text) - 1 do
|
||
|
( char := substring (text, i, 1)
|
||
|
; out := concat(out, if char <> "\n"
|
||
|
then char
|
||
|
else newline_and_indent));
|
||
|
out
|
||
|
end
|
||
|
in
|
||
|
indentstring("Hello\nWorld", " ") = " Hello\n World"
|
||
|
end
|