Hello,
is it possible to get every character of a string?
A string like "asdfghjkl".
I want get "a", "s", "d" and so on...
I tried many variants of a foor loop, but nothing works...
Can you give me a hint about that?
thanks in advance and greetings, pumi
Characters of a string
Moderator: DosItHelp
Re: Characters of a string
Will the string be alpha-numeric or can there be special characters?
The approach you take will depend on that.
The second question is: do you want a plain batch solution or do you want the simplest solution?
The approach you take will depend on that.
The second question is: do you want a plain batch solution or do you want the simplest solution?
Re: Characters of a string
The characters are only alpha-numeric.
Simple solution is ok.
thanks
Simple solution is ok.
thanks
Re: Characters of a string
Here's a plain batch solution to parse out each character.
Code: Select all
@echo off
set "string=asdfghjkl"
set "var=%string%"
:loop
set "char=%var:~0,1%"
echo %char%
set "var=%var:~1%"
if defined var goto loop
echo "%string%"
pause
Re: Characters of a string
thanks, this works!