Why the hell doesn't foreach decode strings

Michel Fortin michel.fortin at michelf.com
Wed Oct 26 07:40:41 PDT 2011


On 2011-10-26 14:20:54 +0000, "Steven Schveighoffer" 
<schveiguy at yahoo.com> said:

> If you have the same normalization, you would at least find all the vali d
> instances.  You'd have to eliminate false positives, by decoding the nex t
> dchar after the match to see if it's a combining character.  This would  be
> a simple function to write.
> 
> All I'm saying is, doing a search on the array should be available.

And all I'm saying is that such a standalone function that eliminates 
the false positive should be available outside of a string type too. 
You'll likely need it for your string type anyway, but there's no 
reason you should't be able to use it standalone on a 
char[]/wchar[]/dchar[].

I think most string algorithms should be able to work with normalized 
character arrays; a new string type should just be a shell around these 
that makes things easier to the user.


> I have a half-implemented string type which does just this.  I need to
> finish it.

That should be interesting.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list