7

I heavily use strings in a project so what i am looking for is a fast library for handling them.I think the Boyer-Moore Algorithm is the best.

Is there a free solution for that ?

menjaraz
  • 7,551
  • 4
  • 41
  • 81
  • I suggest you provide your Delphi version as recent Delphi version build in some powerful string builders. – Justmade Mar 13 '12 at 10:02
  • I am currently using Delphi XE 2 – user1259295 Mar 13 '12 at 10:03
  • Delphi is *very* effective in it's use of strings, you'll need to be a bit more precise in explaining what you need. – Cosmin Prund Mar 13 '12 at 10:06
  • 1
    I saw a few years ago some fast string routines that used the Boyer More Algorithm in asm i thought they were better than the actually contained ones. Am i wrong ? – user1259295 Mar 13 '12 at 10:09
  • Be precise about your question. For example, is your question simply that you want an implementation of Boyer More Algorithm? That would be a valid question. But questions here have to be focussed. Unless you can edit the question with that in mind, I will vote to close. – David Heffernan Mar 13 '12 at 10:20
  • 1
    @user1259295, please move that clarification comment to the question body (or title even) – OnTheFly Mar 13 '12 at 10:23
  • 2
    This topic appears to have been covered before: http://stackoverflow.com/questions/3310865/is-there-a-boyer-moore-string-search-and-fast-search-and-replace-function-and-fa – David Heffernan Mar 13 '12 at 11:10
  • 3
    @user1259295, The Boyer-Moore algorithm is a very specific algorithm that solves a very specific problem (search for sub-string). By itself it's not a "Library" and it doesn't solve the "project heavily uses strings" problem. This question is still vague and needs editing or rephrasing! You need to tell us the *specific* problems you need to solve. You jumped on the Boyer-Moore wagon as soon as it was suggested, but is *that* what you need? Or are you just prematurely optimizing because you don't yet have a problem... – Cosmin Prund Mar 13 '12 at 11:24
  • @CosminPrund, you are kinda distorting the facts, OP mentioned BM algorithm implementation before appropriate code was suggested to him. – OnTheFly Mar 13 '12 at 11:48
  • 1
    @user539484, I don't think I'm distorting anything. Look at the edit chronology, the Boyer-Moore idea wasn't in the first version of the question. Even so, I don't see how a fast search algorithm can be called "optimizing strings" (from the title!). Nor do I understand how searching can be considered handling (as in the title-body). The idea's that Delphi's string handling really is very efficient, and a question like this, with no *actual* stated problem, just gives everyone subject for argument. No stated problem = no possible answer. – Cosmin Prund Mar 13 '12 at 17:04
  • @CosminPrund, yep, despite of all the edits, question is still vague. But look at the comment history too, OP *"jumped on the Boyer-Moore wagon"* **himself**, not *"as soon as it was suggested"* [by us]. So i consider BM-in-asm part "good". – OnTheFly Mar 13 '12 at 18:41

2 Answers2

6

You can consider the following resources implementing Boyer–Moore algorithm:

Last Edit:

The StringSimilarity package of theunknownones project is a good source for fuzzy and phonetic string comparison algorithms:

  • DamerauLevenshtein
  • Koelner Phonetik
  • SoundEx
  • Metaphone
  • DoubleMetaphone
  • NGram
  • Dice
  • JaroWinkler
  • NeedlemanWunch
  • SmithWatermanGotoh
  • MongeElkan
menjaraz
  • 7,551
  • 4
  • 41
  • 81
3

CAUTION: Answering to the comment rather than to the question itself

There is (or, rather, was, because it has been abandoned currently) a Delphi unit (namely!) FastStrings which implements Boyer–Moore string search algorithm by heavy use of inline assembler. Is is one you are looking for?

As side note: project homepage is defunct now as long as author's e-mail, so i'm finding reuse (and modification and, naturally, any further development) of this code rather problematic given how restrictive are licensing terms.

Community
  • 1
  • 1
OnTheFly
  • 2,059
  • 5
  • 26
  • 61
  • @kobik, disregard that, its one of my *true friends* on the path of deadly vengeance :-) Personally, i remember it from the times it has being developed (mostly on IRC channels) – OnTheFly Mar 13 '12 at 11:39
  • @TLama, yes, you are being very persistent on that trolling matter for several recent days. Meanwhile, do you have any sockpuppets for the dirty job? – OnTheFly Mar 13 '12 at 12:27
  • 2
    @kobik Perhaps a better question would be why upvote an answer that says "We used to use FastStrings, but it won't work with XE2, the compiler that you use". Upvoting poor answers isn't really helpful. It just encourages people to write poor answers. – David Heffernan Mar 13 '12 at 14:57
  • 4
    @DavidHeffernan, you have a good point. I didn't even see the XE2 tag when I commented (because there was no such tag?). down-voter should have stated "it won't work with XE2, the compiler that you use..." the one deserves a down-vote is OP for making a big salad (see Cosmin Prund's comment). anyways, this answer can serve those who do not have XE2. – kobik Mar 13 '12 at 15:06
  • @kobik It would not surprise me if whoever downvoted preferred to do so anonymously in this particular case. I really don't think up-voting out of sympathy is helpful. – David Heffernan Mar 13 '12 at 15:24
  • @kobik, i decided to post it as it might be of use for someone who vaguely seek a *string handling lib optimized for speed* but do not remember an exact name (FastStrings project was pretty well known in the previous decade). – OnTheFly Mar 13 '12 at 18:50
  • 1
    I wrote FastStrings :) – Peter Morris Feb 04 '16 at 18:20