First, I would do some manipulation of this string to get it from FORTRAN to .NET.
- Trim any leading space; if the negative sign is there, we want it, but we do not want spaces.
- Replace “D” with “E”.
Below you will get what you need:
string s = " 0.12961924D+01";
s = s.Trim().Replace("D", "E");
double v2 = Double.Parse(s, NumberStyles.Float);
source
share