Forum > Beginners

Check if last character of string is line ending?

(1/1)

Trenatos:
Since I'm working with streams, there are no guarantees that the last character of a specific line is a line ending.

Is there a way to check if the last character is a line ending?

User137:
How are you using the streams? Usual line change is combination of 2 characters: #13#10, also known as CRLF http://wiki.lazarus.freepascal.org/End_of_Line But with streams you shouldn't need to know that, since length can be known before reading the string itself.

Basile B.:

--- Quote from: Trenatos on August 17, 2015, 09:56:36 pm ---Since I'm working with streams, there are no guarantees that the last character of a specific line is a line ending.

Is there a way to check if the last character is a line ending?

--- End quote ---

By chance, do you ask this because of TProcess.Output ?

Trenatos:
Yes.

But the problem has been solved by a piece of code I accidentally remove in an earlier bughunt.

Navigation

[0] Message Index

Go to full version