Spilt a numeric value in dos batch file

May 20, 2009 at 03:50:35
Specs: Windows XP
Hi
I need to split a numeric value ex "111111110" by each digit from the right hand side. Could someone please tell me how to get this done in a DOS batch file
ex :
chr1 = 0
chr2 = 1
chr3 = 1
chr4 = 1
chr5 = 1
chr6 = 1
chr7 = 1
chr8 = 1
chr9 = 1

Thanks


See More: Spilt a numeric value in dos batch file

Report •


#1
May 20, 2009 at 04:29:26
First, are you using DOS or XP? Not the same thing.

Next, will the string always be 9 chars or does the batch need to figure out how long it is?


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
May 20, 2009 at 05:21:23
assuming you are using XP, is not doing homework , here's a vbscript
strnum = "111111110"
result = Split(strnum,"")
For i=1 To Len(strnum)
	WScript.Echo "item: " & Mid(strnum,i,1) 	
Next

you can store the results in an array for further use.

Report •

Related Solutions


Ask Question