What's the fastest/most efficient way to count lines in Rebol?

前端 未结 9 869
星月不相逢
星月不相逢 2021-01-02 07:33

Given a string string, what is the fastest/most-efficient way to count lines therein? Will accept best answers for any flavour of Rebol. I\'ve been working unde

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-02 07:59

    Enhanced PARSE version, as suggested by BrianH:

    i: 1 ; add one as TextMate
    parse text [any [thru newline (++ i)]]
    print i
    

提交回复
热议问题