瀏覽代碼

Update Helper.cpp

michael 1 年之前
父節點
當前提交
132834c3fd
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. 9 2
      code/components/jomjol_helper/Helper.cpp

+ 9 - 2
code/components/jomjol_helper/Helper.cpp

@@ -1221,6 +1221,14 @@ void replaceAll(std::string& s, const std::string& toReplace, const std::string&
 
 bool isStringNumeric(std::string &input)
 {
+	if (input.size() <= 0)
+	{
+		return false;
+	}
+    
+	// Replace comma with a dot
+	replaceString(input, ",", ".", false);
+	
 	int start = 0;
 	int punkt_existiert_schon = 0;
 
@@ -1231,8 +1239,7 @@ bool isStringNumeric(std::string &input)
 
 	for (int i = start; i < input.size(); i++)
 	{
-		// if ((ispunct(input[i])) && (i > 0) && (punkt_existiert_schon == 0))
-		if (((input[i] == '.') || (input[i] == ',')) && (i > 0) && (punkt_existiert_schon == 0))
+		if ((input[i] == '.') && (i > 0) && (punkt_existiert_schon == 0))
 		{
 			punkt_existiert_schon = 1;
 			i++;