title: Substring length in text file using Batch
body: <p>In input, I have a text file which contains numbers separated with a comma.</p>
  
  <pre><code>list.txt
  111221,345,332133,66,5555, and so
  </code></pre>
  
  <p>I want to check the length of each string between the "," delimiter, in order to successively display the length of each word.</p>
  
  <p>For example:</p>
  
  <pre><code>111221 is 6 characters long
  345 is 3 characters long
  332133 is 6 characters long
  66 is 2 characters long
  ...
  </code></pre>
  
  <p>For this, I've written this code but it displays only the first word and the length is always "0". Without the for loop, it works fine for a single chain. Has anyone an idea to fix this?
  Thank you.</p>
  
  <pre><code>@echo off                   
  setlocal enabledelayedexpansion enableextensions
  
  for /f "delims=," %%a in ('type list.txt') do (
  set string=%%a
  set temp_str=%string%
  set str_len=0
  
  :loop
  if defined temp_str (
  
  set temp_str=%temp_str:~1%
  set /a str_len+=1
  goto:loop )
  
  echo !string! is !str_len! characters long
  )
  
  pause
  endlocal
  </code></pre>