lines multimethod

Methods

lines(s:Str) Source: stdlib.ngs:3443
Split s to strings using end-of-line separators. UNIX and Windows line endings supported (Windows - not tested yet). Warning: Max OS <= 9 line separation of CR (\r) is not supported

Example

"xx\nyy".lines()  # %[xx yy]
lines(s:Str, cb:Fun) Source: stdlib.ngs:3453
Split s to strings using end-of-line separators and call cb for each one of the lines. TODO: More efficient implementation, which would not have temporary array of all lines.

Parameters

cbFunction to be called with each line
lines(f:File, cb:Fun) Source: stdlib.ngs:4353
Iterate over lines of the file

Parameters

fClosed File
cbfunction to call with successive lines from the file
lines(f:File) Source: stdlib.ngs:4368
Get all lines of the file

Returns

Arr of Str
lines(f:File, lines_:Arr) Source: stdlib.ngs:4373
Write given lines to the file. Overwrites the file.

Returns

Arr of Str
lines(p:Process) Source: stdlib.ngs:5046
Wait for the process and return lines of its stdout.

Returns

Arr of Str

Example

$(seq 10 2 20).lines().map(Int)  # [10,12,14,16,18,20]
lines(p:Process, cb:Fun) Source: stdlib.ngs:5054
Iterate lines of Process' stdout, calling cb with successive lines. Warning: current implementation waits for the process to finish, accumulates all its stdout, and only then starts calling cb for each line.
lines(cp:CommandsPipeline) Source: stdlib.ngs:5062
Wait for cp and return lines of stdout of the last process.

Returns

Arr of Str

Example

$(seq 3 | tac).lines().map(Int)  # [3,2,1]
lines(cp:CommandsPipeline, cb:Fun) Source: stdlib.ngs:5070
Wait for cp and return call cb for each line of stdout of last process. Warning: current implementation waits for the processes to finish, accumulates all stdout of the last process, and only then starts calling cb for each line.

Returns

Arr of Str