Computing.Net > Forums > Programming > Spilt a numeric value in dos batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Spilt a numeric value in dos batch file

Reply to Message Icon

Name: newdosuser
Date: May 20, 2009 at 03:50:35 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 20, 2009 at 04:29:26 Pacific
Reply:

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


0

Response Number 2
Name: ghostdog
Date: May 20, 2009 at 05:21:23 Pacific
Reply:

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.

0
Reply to Message Icon

Related Posts

See More


about file Writing to a file at a sp...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Spilt a numeric value in dos batch file

DOS Batch File Commands www.computing.net/answers/programming/dos-batch-file-commands/14637.html

DOS batch files question www.computing.net/answers/programming/dos-batch-files-question/12395.html

For loop in DOS batch program www.computing.net/answers/programming/for-loop-in-dos-batch-program/18227.html