# EndOfLine.Length

**URL:** <https://forum.xojo.com/t/endofline-length/66675>\
**Category:** General\
**Created:** [November 13, 2021, 10:34pm UTC](https://forum.xojo.com/t/endofline-length/66675 "2021-11-13T22:34:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [November 13, 2021, 10:34pm UTC](https://forum.xojo.com/t/endofline-length/66675/1 "2021-11-13T22:34:08Z")

</div>

This does not appear to exist. How, then, can I determine the length of EndOfLine? OK - I can set a string to EndOfLine and take the string’s length, but that seems a tad heavy.

NB: I tested and the length is 1 on macOS and 2 on Win7. So, not the same.

---

<div class="post-metadata">

**Author:** ![John\_McKernon](https://forum.xojo.com/user_avatar/forum.xojo.com/john_mckernon/32/183_2.png) [@John\_McKernon](https://forum.xojo.com/u/John_McKernon)\
**Post date:** [November 14, 2021, 1:26am UTC](https://forum.xojo.com/t/endofline-length/66675/2 "2021-11-14T01:26:24Z")

</div>

EndOfLine is a string, so can just use Len(EndOfLine)

On MacOS, lines always end in a linefeed only (ASCII 10). Windows uses carriage return (ASCII 13) + linefeed (ASCII 10)

However, you can read strings and then parse by EndOfLine.Windows and/or EndOfLine.Macintosh as needed. Ditto for when you’re creating strings.

---

<div class="post-metadata">

**Author:** ![Ivan\_Tellez](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/a9a28c/32.png) [@Ivan\_Tellez](https://forum.xojo.com/u/Ivan_Tellez)\
**Post date:** [November 14, 2021, 1:56am UTC](https://forum.xojo.com/t/endofline-length/66675/3 "2021-11-14T01:56:00Z")

</div>

> [@TimStreater](#):
>
> This does not appear to exist. How, then, can I determine the length of EndOfLine?

well, that is a fixed lenght depending on the OS, like John says and all of that is on the documentation

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [November 14, 2021, 2:45am UTC](https://forum.xojo.com/t/endofline-length/66675/4 "2021-11-14T02:45:13Z")

</div>

EndOfLine is a method that returns a string. So while Len(EndOfLine) is valid, EndOfLine.Length is not.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [November 14, 2021, 8:24am UTC](https://forum.xojo.com/t/endofline-length/66675/5 "2021-11-14T08:24:12Z")

</div>

That it is a method is un-obvious since the doc describes it as a class and one can say such as EndOfline.unix.

Since my app is cross-platform, if I’m calculating a length I want to get the answer in a simple cross-platform way.

len(EndOfLine) does the trick and that’s good enough, so thanks for that.

Of course the IDE says len() is deprecated so go figure.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [November 14, 2021, 9:35am UTC](https://forum.xojo.com/t/endofline-length/66675/6 "2021-11-14T09:35:41Z")

</div>

See blog post: [All about EndOfLine](https://www.mbs-plugins.de/archive/2020-11-28/All_about_EndOfLine/monkeybreadsoftware_blog_xojo)

EndOfLine returns an EndOfLine Object, which can convert to string.  
For newer version they could add a Length method there.

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [November 14, 2021, 11:32am UTC](https://forum.xojo.com/t/endofline-length/66675/7 "2021-11-14T11:32:09Z")

</div>

Use

`EndOfLine.Native.Length`

for non-deprecated code.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [November 14, 2021, 11:52am UTC](https://forum.xojo.com/t/endofline-length/66675/8 "2021-11-14T11:52:43Z")

</div>

I would have loved to just see Length being a constant in the EndOfLine class.

For windows with value 2 and 1 for other platforms.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [November 14, 2021, 12:17pm UTC](https://forum.xojo.com/t/endofline-length/66675/9 "2021-11-14T12:17:44Z")

</div>

> [@Beatrix\_Willius](#):
>
> EndOfLine.Native.Length

in 2021r3 ?
