in reply to Re: Matching First Character of Strings Efficiently
in thread Matching First Character of Strings Efficiently

hardburn,
I did say first letter, not "first character". Regardless, your first proposal will not work because it is checking one string against a hard coded value. The requirement is to test the first letter/character of one string against the first letter/character of a second string.

I will add your split solution to the benchmark.

While I did not explicitly state modifying the string is not allowed, the expensive_function will not work unless the strings were "as received". I will however add this solution to the benchmark by appending the chop'd character back on to the re-reversed string.

Cheers - L~R
  • Comment on Re: Re: Matching First Character of Strings Efficiently