Page 1 of 1

Convert string to int

Posted: 24 Aug 2011 01:00
by harishkothuri
Hi , I want to convert string to an interger in batch program, Please help.

Thanks,
Harish

Re: Convert string to int

Posted: 24 Aug 2011 02:23
by Ed Dyreen
'
Batch only knows one type of variables :$variable STRING, basically a memory pointer.

Code: Select all

set /a "$var=1" :: string
set    "$var=1" :: string
It sucks yes I know, you won't be doing this in batch:

Code: Select all

procedure MyProcedure
var
   MyVar1:integer;
   MyVar2:string ;
begin
   MyVar1 :=  1 ;
   MyVar2 := '1';
End;