* * *

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

M+AUDIO

  • New member
  • *
  • Posts: 37
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: 4505
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 »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

M+AUDIO

  • New member
  • *
  • Posts: 37
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

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus