Quirrel4.41.0

iostream.blob.writestring

Method of blob, from module "iostream"
instance.writestring(str: string): int

Writes the string and returns the number of characters written

Parameters

strstringthe string to write

Return value

See iostream.stream.writestring for the generic contract.

Notes

Writing past the current len grows this blob to fit, the same as writen.

Example

examples/iostream/blob/writestring.nut
from "iostream" import blob

let b = blob(0)          // empty: writing to it must grow it
println("b.writestring(\"hi\") =", b.writestring("hi"))
println("b.len() =", b.len())
println("b.as_string() =", b.as_string())
Output:
b.writestring("hi") = 2
b.len() = 2
b.as_string() = hi

See also

writestringWrites the string and returns the number of characters written
writeblobWrites the given blob and returns the number of bytes written
as_stringReturns the blob contents as a string
blobclass index