View Full Version : Detect new line in string?

02 February 2012, 08:33 PM
I know I can add a new line to a string by adding "\n" to the string.

But the resulting string contains a carriage return/line feed character, rather than "\n"

So how do I take a string that contains more than one line, and by examining each character in it, determine where the new lines begin?

edit: damn, posted this too soon. I figured out that if I convert each character to an int using bit.charasint, carriage returns have a unique value that I can use to identify them with.

02 February 2012, 04:30 PM
if i get it, that may helps --
ss = Our_String as StringStream
newLinesPos = #(0)
while not eof ss do
skipToNextLine ss
append newLinesPos (filePos ss)
free ss

CGTalk Moderation
02 February 2012, 04:30 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.