real*8 function strdbl(string,type,ng) ! format convert ascii string to real num using supplied type implicit none character*(*) string integer length,type,ival logical ng ng=.true. !if conversion fails length=len(string) !length of user (sub)string strdbl=0.0 if(type < 0) return !not a number if(type == 2) then !integer if((string(1:1) == 'H').or.(string(1:1) == 'h')) then read(string(2:length),16,err=99) ival !hex 16 format(z16) elseif(string(1:1) == '"') then read(string(2:length),8,err=99) ival !octal 8 format(o16) else read(string(1:length),10,err=99) ival !base ten integer 10 format(i16) endif ng=.false. strdbl=ival !return uniformly as float (=>use nint) elseif(type == 3 .or. type == 4) then !real read(string(1:length),*,err=99) strdbl endif ng=.false. 99 return end