Searching and Reading Strings
Functions like Read and Find are most often used for processing text and data from external files. In some cases, however, you may find it convenient to use these same functions to process strings within the Wolfram Language. You can do this by using the function StringToStream, which opens an input stream that takes characters not from an external file, but instead from a Wolfram Language string.
|StringToStream["string"]||open an input stream for reading from a string|
|Close[stream]||close an input stream|
Input streams associated with strings work just like those with files. At any given time, there is a current position in the stream, which advances when you use functions like Read. The current position is given as the number of characters from the beginning of the string by the function StreamPosition[stream]. You can explicitly set the current position using SetStreamPosition[stream,n].
Particularly when you are processing large volumes of textual data, it is common to read fairly long strings into the Wolfram Language, then to use StringToStream to allow further processing of these strings within the Wolfram Language. Once you have created an input stream using StringToStream, you can read and search the string using any of the functions discussed for files.