Skip to content

Commit

Permalink
Support non-float in float conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
FWDekker committed Oct 6, 2020
1 parent 5bd2b25 commit 903ce5d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Edit scripts/ExportCore.pas
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ function boolToStr(bool: Boolean): String;
(**
* Parses the given string to a float, rounds it, and turns that into a string.
*
* If the given string is not a float, the given string is returned.
*
* @param float the float to parse and round
* @return a string describing the rounded integer
*)
Expand All @@ -346,7 +348,12 @@ function parseFloatToInt(float: String): String;
result := '';
exit;
end;
result := intToStr(round(strToFloat(float)));

try
result := intToStr(round(strToFloat(float)));
except
result := float;
end;
end;


Expand Down

0 comments on commit 903ce5d

Please sign in to comment.