:unittest.strLen

Test cases for the :strLen function

Description: call:unittest.strLen
Dependencies: :strLen, :Format
Script:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
:unittest.strLen
:$created 20081124 :$changed 20081124
:$source https://www.dostips.com
for %%C in (
        ""
        "H"
        "Hi"
        "Hi_"
        "Hi T"
        "Hi There, what's up!"
    ) do (
    set "str=%%~C"
    call:strLen str len && (
        call:Format "[5] characters for [20]." "'%%len%%'" "'%%str%%'"
    )
)
EXIT /b
Script Output:
 DOS Script Output
---- :unittest.strLen - output
'0'   characters for ''                  .
'1'   characters for 'H'                 .
'2'   characters for 'Hi'                .
'3'   characters for 'Hi_'               .
'4'   characters for 'Hi T'              .
'20'  characters for 'Hi There, what's up.
----