From ec076315bb8b5f901670fee1c06db028242b21fd Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Mon, 27 Feb 2023 16:05:52 +0100 Subject: Various lock stitch options (#2006) Co-authored-by: Lex Neva --- lib/utils/string.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/utils/string.py') diff --git a/lib/utils/string.py b/lib/utils/string.py index e9204076..7ed99b77 100644 --- a/lib/utils/string.py +++ b/lib/utils/string.py @@ -7,7 +7,15 @@ def string_to_floats(string, delimiter=","): """Convert a string of delimiter-separated floats into a list of floats.""" floats = string.split(delimiter) - return [float(num) for num in floats] + return [float(num) for num in floats if _is_float(num)] + + +def _is_float(float_string): + try: + float(float_string) + return True + except ValueError: + return False def remove_suffix(string, suffix): -- cgit v1.2.3