std.string.inPattern()
Lutger
lutger.blijdestijn at gmail.com
Tue Oct 23 05:57:03 PDT 2007
davidl wrote:
> 在 Tue, 23 Oct 2007 20:07:53 +0800,Alexander Panek
> <alexander.panek at brainsware.org> 写道:
>
>> On Mon, 22 Oct 2007 10:22:48 +0100
>> "Janice Caron" <caron800 at googlemail.com> wrote:
>>
>>> I noticed in the docs that the pattern parameter to inPattern is
>>> specified as an array of chars, not an array of dchars.
>>>
>>> I realise that one can easily be converted to the other, but it leaves
>>> me wondering ... does inPattern() work with non-ASCII characters?
>>
>> char[] is not ASCII, but UTF-8, so any UTF-8 sequence (may it be
>> multibyte, or not) is valid, I suppose. (I don't know how inPattern
>> works, though, so I can't answer the original question - just wanted
>> to clarify this.)
>>
>
> I think char[] is just an array of char. Just some stdlib APIs treat it
> as it's UTF8 encoded.
>
It's more than that, you can do this with char[] and it works with
multibyte characters in UTF-8:
foreach (dchar ch; pattern)
/* stuff */
This is what inPattern does.
More information about the Digitalmars-d
mailing list