Line count in macro read_file()

AVKuznetsov kuzn at htsc.mephi.ru
Wed Apr 9 08:17:51 CEST 2008


On Tue, 08 Apr 2008 20:05:44 +0200
Tony Balinski <ajbj at free.fr> wrote:

Hi,

> Alternatively,
>   s = read_file(filename)
>   nls = replace_in_string(s, ".*", "", "regex")
>   return length(nls) + (s != "" && substring(s, -1) != "\n")

I like this nice elegant method.

Alexey


More information about the Discuss mailing list