Page 1 of 1

Counting LOC

Posted: Mon Dec 17, 2001 11:33 am
by Steve Hodgson
Is there any way of counting lines of code within TextPad?

I'm not referring to counting lines of text - i.e. turn on line numbering and look at the last line or using document properties to see how many lines are in a module.

I wondered whether it is possible to directly exlude blank lines from the count. I can think of ways to get the info indirectly but they are all laborious.

TIA,

Steve

Re: Counting LOC

Posted: Mon Dec 17, 2001 1:19 pm
by Andreas
The "easiest" way I know is to do a search for ^.+$ (Regex) and replace by & and do a replace all, then look into status bar, i.e. replace all non-empty lines by themselves.
You can also record this as a macro, and then use it with just one click on the macro name in the Macro menue.

Note: this counts all non-empty-lines, i.e. also lines containing only spaces.
To exclude these, use
^[ \t]*[^ \t].*$
for searching, then only lines containing one non-white character are counted.

Re: Counting LOC

Posted: Mon Dec 17, 2001 1:20 pm
by Andreas
last part should read:
containing at least one non-white character are counted.