Work with string streams?

Let's say I have a stringsteam in C ++, and I want to do different operations with it, for example:

Search for a sequence of characters, Convert a block of text to int (in the middle of a line), Move the get pointer back and forth, etc.

What is the standard / common way to do similar things with strings?

+3
source share
3 answers

You can use the stringstream :: str () method, which returns the associated std :: string object. Then you can perform the required operations on the returned string.

+5
source

As the name says, stringtream is a stream. A stream allows sequential access rather than random access. If you need random access, you can use the stringstream :: str () function to get the string version of the string.

+3
source

Source: https://habr.com/ru/post/1707675/


All Articles