Class
-
io
:
StringReader
Represents a reader which will wrap string content as a channel.
Methods
Reads string as JSON using the reader.
io:StringReader reader = new("{\"name\": \"Alice\"}");
json|io:Error? person = reader.readJson();
-
Return Type
(json | Error) JSON or else
io:Errorif any error occurred
Reads a string as XML using the reader.
io:StringReader reader = new("<Person><Name>Alice</Name></Person>");
xml|io:Error? person = reader.readXml();
-
Return Type
(xml | Error?) XML or else
io:Errorif any error occurred
Reads the characters from the given string.
io:StringReader reader = new("Some text");
string|io:Error? person = reader.readChar(4);
Parameters
- nCharacters int
-
Number of characters to be read
-
Return Type
(string | Error?) String or else
io:Errorif any error occurred