Percent of Apex Used: Do spaces count?

The limit on the amount of characters you can have in Apex is 3,000,000. I understand that comments and test classes do not count towards this limit. Another developer just asked me if the space character counts and I could not answer with certainty. I hope that someone out there can tell me that they do not count against the character limit.

Answer

A quick test would suggest that they do…

Here is a simple class in my DE

simple class

and the code usage

usage1

If I add loads of characters, the usage goes up..

duff characters

usage 2

when I removed them, it went back down, now I added loads of white space, and the usage climbed again:

white space

usage 3

And this is chaining lots of spaces together, so I would say that lots of individual spaces in real code will behave the same way..!

It even counts spaces at the end of a line, as you can see here:

end of line

usage 5

It does also count the spaces at the start of a line (the indentation)

BUT

It does not appear to count spaces in lines containing nothing but spaces though!

Attribution
Source : Link , Question Author : aspire4more , Answer Author : Simon Lawrence

Leave a Comment