Welcome, guest | Sign In | My Account | Store | Cart

A way for checking string length.

Batch, 11 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
@echo off
  setlocal
    set "str=ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    set "len=0"
    
    :loop
    if defined str (set str=%str:~1%& set /a len+=1 & goto:loop)
    
    echo String length: %len%
  endlocal
exit /b
Created by greg zakharov on Wed, 18 Sep 2013 (MIT)
Batch recipes (42)
greg zakharov's recipes (59)

Required Modules

  • (none specified)

Other Information and Tasks