::turn all strings with decimals to integers to perform arithmetic ops ::does not error check for non-numerics or non-numeric formatting ::I check beforehand or it left as an exercise for the reader set mynum=12.34 call:str2dec num pos %mynum% echo str2dec num %num% , pos %pos% for %mynum% set mynum=12.3 call:str2dec num pos %mynum% echo str2dec num %num% , pos %pos% for %mynum% set mynum=12. call:str2dec num pos %mynum% echo str2dec num %num% , pos %pos% for %mynum% set mynum=12 call:str2dec num pos %mynum% echo str2dec num %num% , pos %pos% for %mynum% set mynum=.34 call:str2dec num pos %mynum% echo str2dec num %num% , pos %pos% for %mynum% GOTO:EOF :Str2Dec ::Str2Dec(retVal,decPlaces,strIn) ::returns the integer to %1 of strIn, %3, shifted %2 places to the left ::eg Str2Dec num pos 12.34 returns num=1234 pos=2 SET
source share