# Module `pl.stringio`

Reading and writing strings using file-like objects.

    f = stringio.open(text)
    l1 = f:read()  -- read first line
    n,m = f:read ('*n','*n') -- read two numbers
    for line in f:lines() do print(line) end -- iterate over all lines
    f = stringio.create()
    f:write('hello')
    f:write('dolly')
    assert(f:value(),'hellodolly')

See the Guide.

## Functions

create () | create a file-like object which can be used to construct a string.
open (s) | create a file-like object for reading from a given string.

## Functions

create ()
  create a file-like object which can be used to construct a string. The resulting object has an extra `value()` method for retrieving the string value. Implements file:write, `file:seek`, `file:lines`, plus an extra `writef` method which works like utils.printf.

  ### Usage:

      f = create(); f:write('hello, dolly\n'); print(f:value())

open (s)
  create a file-like object for reading from a given string. Implements file:read.

  ### Parameters:

  - s string The input string.

  ### Usage:

      fs = open '20 10'; x,y = f:read ('*n','*n'); assert(x == 20 and y == 10)

generated by LDoc 1.5.0