Counting LOC

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Steve Hodgson

Counting LOC

Post 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
Andreas

Re: Counting LOC

Post 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.
Andreas

Re: Counting LOC

Post by Andreas »

last part should read:
containing at least one non-white character are counted.
Post Reply