From 903ce5d32b26587998142743d7ae075db235fde3 Mon Sep 17 00:00:00 2001 From: "Felix W. Dekker" Date: Tue, 6 Oct 2020 17:18:05 +0200 Subject: [PATCH] Support non-float in float conversion --- Edit scripts/ExportCore.pas | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Edit scripts/ExportCore.pas b/Edit scripts/ExportCore.pas index 226fc41..fd8a420 100644 --- a/Edit scripts/ExportCore.pas +++ b/Edit scripts/ExportCore.pas @@ -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 *) @@ -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;