Sublime Forum

Is a newline always represented internally by '\n'?

#1

Am I correct in thinking that a newline is always represented internally by \n regardless of what OS Sublime Text is running on?

So the following code snippet would be a reliable way to check for a blank line on Linux, OS X, and Windows?

text = view.substr(region)

if len(text) == 1 and text[0] == "\n":
    pass

Thanks.

0 Likes

#2

Yes. The line ending setting (which can be changed individually per file) only plays a role when saving the file.

2 Likes

#3

Great. Thanks for your super speedy responese FichteFoll.

0 Likes