From b3046a8f88a5377aebfc8b9156e762af80bd04c7 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sun, 3 Dec 2017 10:34:31 +0000 Subject: [PATCH] fpspreadsheet: Avoid confusion of fraction detection by dates git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6085 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/source/common/fpsutils.pas | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/fpspreadsheet/source/common/fpsutils.pas b/components/fpspreadsheet/source/common/fpsutils.pas index 61cd2455a..0d801b502 100644 --- a/components/fpspreadsheet/source/common/fpsutils.pas +++ b/components/fpspreadsheet/source/common/fpsutils.pas @@ -1499,19 +1499,29 @@ var p: Integer; s, sInt, sNum, sDenom: String; i,num,denom: Integer; + slashCount: Integer; begin Result := false; s := ''; sInt := ''; sNum := ''; sDenom := ''; + slashCount := 0; p := 1; while p <= Length(AText) do begin case AText[p] of '0'..'9': s := s + AText[p]; - ' ': begin sInt := s; s := ''; end; - '/': begin sNum := s; s := ''; end; + ' ': begin + sInt := s; + s := ''; + end; + '/': begin + sNum := s; + s := ''; + inc(slashCount); // avoid confusion with dates (2017/1/1) + if slashCount > 1 then exit; + end; else exit; end; inc(p);