sprint

Definition: string s = sprint(object x, integer maxlen=-1)
Description: The representation of x as a string of characters is returned.
This is exactly the same as print(fn, x[, maxlen]), except that the output is returned as a string, rather than being sent to a file or device.
x can be any phix object.

The optional second parameter indicates the maximum desired length in characters of the returned result.
Anything beyond this is indicated by a trailing "..", potentially in addition to the specified length.
See the Technicalia drop-down below for more details.
Comments: The atoms contained within x will be displayed to a maximum of 10 significant digits, just as with print().
Example 1:
s = sprint(12345)   -- s is "12345"
Example 2:
s = sprint({1,2.5,"hello",{4,5.5}})
-- s is "{1,2.5,\"hello\",{4,5.5}}"
Example 3:
s = sprint("hello")
-- s is "\"hello\""
See Also: print, sprintf, value, get