Mid() vs Mid$()

后端 未结 3 1353
谎友^
谎友^ 2021-01-02 00:54

According to the documentation in VB6 the Mid() function returns a variant, but Mid$() returns a string and apparently this is more efficient.

My questions are :

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-02 01:21

    Honestly, I think it's negligible.

    Maybe you can try something like this. Download the "High-Performance Timer Object" from http://ccrp.mvps.org/, do a long loop (1.000.000 iterations or so) of string operations, and measure the run time difference. By "operations" I mean: Concatenation of Variants as opposed to concatenation of Strings. Mid() and Mid$() will very likely perform the same. OTOH - you can test that as well.

    If you did, I'd be interested if you posted the results.

提交回复
热议问题