1

I'd like to have a Pos() adapted to be used specifying boundaries within the Source string, rather than have it perform the search in the entire data. F.e: NewPos(SubStr, SourceString, Offset, EndingOffset)

It should be a modification of the current ASM FastCode implementation in the latest Delphi XE3, so that it will be faster than a PurePascal implementation (and obviously also faster than using a simple Pos or PosEx). Also, it should work with Unicode strings.

hikari
  • 3,393
  • 1
  • 33
  • 72
  • 1
    This is quite a specific requirement. Do you have at least a Pascal implementation? Perhaps that way you can ask in http://codereview.stackexchange.com/ – Leonardo Herrera Jan 09 '13 at 18:10
  • Purepascal won't do, too slow. Ideally it should be either a small change to the current XE3 ASM code, or pick the older FastCode routine, make it work for unicode, then do the change over that. – hikari Jan 09 '13 at 23:17
  • Thanks for the link, I'll post the existing code there. – hikari Jan 09 '13 at 23:21
  • until you test it you don't know for sure. And while I think you may be right, having a baseline implementation may help others help you. – Leonardo Herrera Jan 10 '13 at 03:45

1 Answers1

-1

Have a look at PosEx in the StrUtils unit. That looks like what you're looking for...

Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
  • PosEx only takes a starting offset, I need to specify also a limit offset within where Pos should work on. – hikari Jan 05 '13 at 18:57
  • 1
    Mason, in XE3 the `Posex()` part has been incorporated into the `Pos()` functions in System.pas. – LU RD Jan 05 '13 at 19:10