GlobalAccessSoftware icon

string_length.bat

GlobalAccessSoftware | PRO | 11/16/23 05:53:43 AM UTC | 0 ⭐ | 14219 👁️ | Never ⏰ | []
Batch |

770 B

|

Software

|

0 👍

/

0 👎

 
 
:::::::::::::::::::::::::::::::::::::::::::
::: string_length.bat Special Function  :::
:::::::::::::::::::::::::::::::::::::::::::
::: An extremely cool function found on :::
::: StackExchange and I wish I'd gotten :::
::: the contributors name and followed. :::
::: Split out from runtime_display.bat  :::
::: v7.9.8.92 20221125101121  by -JpE-  :::
:::::::::::::::::::::::::::::::::::::::::::
 
::: RC5
::: Special Function Finds String Length
:strlen <resultVar, stringVar>
(
  setlocal EnableDelayedExpansion
  set "s=!%~2!#"
  set "len=0"
  for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (
    if "!s:~%%P,1!" NEQ "" ( 
      set /a "len+=%%P"
      set "s=!s:~%%P!"
    )
  )
)
( 
  endlocal
  set "%~1=%len%"
  exit /b %ERRORLEVEL%
)
 
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎