Parse a number in scientific notation

Hi from a device i get a string with a number in scientific notation (for example ‘+0.9876E+1’) and has to parse it into a float. Has anyone done this before or any ideas?

VAR
	rVar : REAL;
	stVar : STRING[80];
END_VAR

PROGRAM _INIT
	stVar	:= '+0.9876E+1';
END_PROGRAM

PROGRAM _CYCLIC
	rVar	:= STRING_TO_REAL(stVar);
END_PROGRAM
3 Likes