Keep set statements only in the endlocal block

Currently the script uses code of the following format to return
values over the endlocal barrier:

    :function_name
        setlocal
        <function body>
        (
            endlocal
            <set statements>
            goto :eof
        )

Change this to the following format so that the endlocal command
aligns with the setlocal command.

    :function_name
        setlocal
        <function body>
        endlocal & (
            <set statements>
        )
        goto :eof

The new format has the additional benefit that all the set
statements used to return values are neatly separated into a
neat code block with an additional level of indentation. The
endlocal command and the goto statement remain at the same level
of indentation as that of the function body.

Currently this change in format applies to exactly one function
in the script, i.e. :string_length. Other functions in the
script do not return values.