On Sat, 18 Jul 2015 00:26:47 GMT, Taylor Gronka wrote:

On Sat, 11 Jul 2015 20:58:45 GMT, Chuck wrote:

Is there a good way to check a string for the proper length when I convert it to an Bson objectID. The object ID length must be 24 characters, which works fine when using ASCII characters, but breaks if someone adds an accented letter (e.g. é), as this takes up two characters. I know that I can use regular expressions to halt the program if an accented letter (or nonASCII-style letter) is found, but is there a more proper way to do this?

When I do an ID search for BsonObjectID.fromString("55981e8fbea1ebc0dba665a8"), it works fine.
When I do an ID search that has an accented letter, 55981é8fbea1ebc0dba665a8, it breaks.

DLang has 3 types for characters and therefore strings, if I'm not mistaken. dchar, wchar, dstring, and wstring are probably the types you need to use.

I haven't used them myself yet, so I'm not sure which one you'll want to use, but this example uses dstring for the character you're specifying:
http://ddili.org/ders/d.en/strings.html

Thank you very much. That's what I was looking for.