StringStream Values

The StringStream class allows you to construct and parse strings using all the text file I/O functions. For example, you can set up a StringStream and build it up by performing prints and formats to it, just as you would to a text file. Conversely, you can convert a String into a StringStream and then work through it using functions like readLine(), readValue(), skipToString(), etc. Since Strings are easily converted to and from StringStreams, this is often a convenient way to work on large, complex strings.

The StringStream class can be used in conjunction with the AppData accessing functions for storing and retrieving large and complex amounts of script-generated data permanently within a 3ds max scene file.

Constructors

stringStream <initial_string>

<string> as stringStream

convert existing String to StringStream.

See also String Literals and String Values.

Operators

<stringstream> as string

convert StringStream to a String

Methods

copy <stringstream>

create a separate copy of the StringStream

Associated Methods

print <value> to:<stringstream>

format "<fmt_string>" {values} to:<stringstream>

The print() and format() functions provide a way to build up a StringStream a piece at a time. As with text file output, each call to print or format appends to existing text, the StringStream dynamically grows as needed. Note that you can reposition output streaming using the seek() function documented below.

The following functions are identical to the text file input functions available for text FileStream values. See the FileStream Values class documentation for details. When called on StringStream instances, they read progressively through the string extracting successive values and lines and characters, etc.

readValue <stringstream>

readExpr <stringstream>

readLine <stringstream>

readChar <stringstream>

readChars <stringstream> <number>

readDelimitedString <stringstream> <string>

skipToString <stringstream> <string>

skipToNextLine <stringstream>

execute <stringstream>

filePos <stringstream>

seek <stringstream> <pos>

eof <stringstream>

close <stringstream>

flush <stringstream>

The close() and flush() functions are provided for consistency with file I/O but are not necessary for StringStreams and do nothing if called.