Recent

Author Topic: [Solved] TStringList helper to do Find for PChar buffer  (Read 1723 times)

Alextp

  • Hero Member
  • *****
  • Posts: 1367
    • UVviewsoft
[Solved] TStringList helper to do Find for PChar buffer
« on: July 20, 2021, 05:27:45 pm »
In my app CudaText I can improve the parser speed if I can do TStringList.Find not for a string, but for a buffer (PChar pointer + length, not 0-terminated!).
Maybe this function or a class helper exists, somebody made it?
StringList is sorted.
« Last Edit: July 20, 2021, 11:42:26 pm by Alextp »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9521
  • FPC developer.
Re: TStringList helper to do Find for PChar buffer
« Reply #1 on: July 20, 2021, 05:36:00 pm »
TStringlist is not allocated as continues block of memory, but as an array of string

Alextp

  • Hero Member
  • *****
  • Posts: 1367
    • UVviewsoft
Re: TStringList helper to do Find for PChar buffer
« Reply #2 on: July 20, 2021, 06:00:03 pm »
marcov,
I know it. And Find for PChar can be implemented.

Alextp

  • Hero Member
  • *****
  • Posts: 1367
    • UVviewsoft
Re: TStringList helper to do Find for PChar buffer
« Reply #3 on: July 20, 2021, 11:41:55 pm »
I wrote this code, it is here in the TStringList2 class:
https://github.com/Alexey-T/EControl/blob/master/econtrol/ec_strlist2.pas

Solved.

 

TinyPortal © 2005-2018