Do /L again

#1
Hello.

My issue:

I'm parsing string using Do /L with delimiter /T

Code:
*Do item in /T";" /L .COM;.EXE;.BAT;.CMD
   *Echo ^>%[item]^<
*EndDo
Works, as expected.

Now I want to add at the first position an empty item:
Code:
*Do item in /T";" /L ;.COM;.EXE;.BAT;.CMD
   *Echo ^>%[item]^<
*EndDo
Works as previous code, unexpected

But it is possible to add an empty item at the end. This example works as expected:
Code:
*Do item in /T";" /L .COM;.EXE;.BAT;.CMD;
   *Echo ^>%[item]^<
*EndDo
Any suggestions?
 
May 29, 2008
529
3
Groton, CT
#2
This won't work in general, but if you're processing file extension strings, try using just a "." as the first item like
Code:
*Do item in /T";" /L  .;.COM;.EXE;.BAT;.CMD
 
#8
Hmm... Looks OK, but... in
Code:
do i in /T";" /L ^k^k;a;b;c ( echo %i )
The result is
Code:
a
b
c
I would expect to get
Code:
ECHO OFF
a
b
c
Unescaped ^k^k is discarded by echo, but it is not an empty string:
Code:
do i in /T";" /L ^k^k;a;b;c ( echo %@len[%i] )
do i in /T";" /L ^k^k;a;b;c ( echo %@quote[%i] )
May be, solution of my issue doesn't exist :( I've decided to add some logic to my script.