Why the hell doesn't foreach decode strings
Walter Bright
newshound2 at digitalmars.com
Mon Oct 24 14:27:46 PDT 2011
On 10/24/2011 7:02 AM, Steven Schveighoffer wrote:
> On Sat, 22 Oct 2011 05:20:41 -0400, Walter Bright <newshound2 at digitalmars.com>
> wrote:
>
>> On 10/22/2011 2:21 AM, Peter Alexander wrote:
>>> Which operations do you believe would be less efficient?
>>
>> All of the ones that don't require decoding, such as searching, would be less
>> efficient if decoding was done.
>
> Searching that does not do decoding is fundamentally incorrect. That is, if you
> want to find a substring in a string, you cannot just compare chars.
Sure you can. A Unicode character is a string, a Unicode string is a string of
those strings. So, searching for a Unicode character is searching for a substring.
Doing this character by character is standard, rote stuff. It's how grep works,
for example.
More information about the Digitalmars-d
mailing list