Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Question about inserting new line into string

$
0
0
Hi,

I'm having trouble with inserting new line into a string. I must change every "." character in a string for a new line.

I have tried many ways. One of them was this:

 
for (int i = 0; i < textLength; i++)	 
{
	if (allText.at(i) == '.')
	{
	allText.erase(i, 1);
	allText.insert(i, "\n");
	textLength++;
	}
}



Probably is a very easy thing for most of you, but I just can find a solution.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>