Recent

Author Topic: TStringHelper Function LastIndexOf Returns Exception  (Read 3713 times)

M+AUDIO

  • New Member
  • *
  • Posts: 48
TStringHelper Function LastIndexOf Returns Exception
« on: June 07, 2017, 03:54:04 pm »
Hi,
As the title say's.
A bug?
Sample project attached.

---
FPC trunk r36176 Windows 7 64bit

Thaddy

  • Hero Member
  • *****
  • Posts: 18765
  • To Europe: simply sell USA bonds: dollar collapses
Re: TStringHelper Function LastIndexOf Returns Exception
« Reply #1 on: June 07, 2017, 06:24:24 pm »
That's a bug. Plz report it on the fpc bug tracker under rtl.
I simplified it somewhat, but it is repeatable:
Code: Pascal  [Select][+][-]
  1. program lasti;
  2. uses sysutils;
  3. const
  4.   txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.';
  5. begin
  6.   writeln(txt.LastIndexOf('ut').ToString); // IndexOf works correct.
  7. end.

LastIndexOf is not working at all. And it is an FPC bug in sysutils, not Lazarus.
   
« Last Edit: June 07, 2017, 06:26:58 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

M+AUDIO

  • New Member
  • *
  • Posts: 48
Re: TStringHelper Function LastIndexOf Returns Exception
« Reply #2 on: June 07, 2017, 08:12:10 pm »
OK, thanks.
Done using your simplified version: https://bugs.freepascal.org/view.php?id=31975

 

TinyPortal © 2005-2018