|
// retoor <retoor@molodetz.nl>
|
|
|
|
var lines = "line1\nline2\nline3".splitLines
|
|
System.print(lines.count) // expect: 3
|
|
System.print(lines[0]) // expect: line1
|
|
System.print(lines[1]) // expect: line2
|
|
System.print(lines[2]) // expect: line3
|
|
|
|
var crlfLines = "a\r\nb\r\nc".splitLines
|
|
System.print(crlfLines.count) // expect: 3
|
|
System.print(crlfLines[0]) // expect: a
|
|
System.print(crlfLines[1]) // expect: b
|
|
System.print(crlfLines[2]) // expect: c
|
|
|
|
var chars = "abc".chars
|
|
System.print(chars.count) // expect: 3
|
|
System.print(chars[0]) // expect: a
|
|
System.print(chars[1]) // expect: b
|
|
System.print(chars[2]) // expect: c
|
|
|
|
System.print("".chars.count) // expect: 0
|