Case Insensitive in D

jessekphillips

Jesse Phillips

Posted on September 2, 2019

Case Insensitive in D

Let me begin with the naive approach before I tell you to go with the naive approach.

import std.string;

assert("I be Big".toLower == "i be big");
Enter fullscreen mode Exit fullscreen mode

As I mentioned last time unicode isn't simple. Well it isn't easier with changing characters and this mostly isn't a unicode problem. The upper/lowercase of a character in one language changes in another. This is where localization comes into play.

I'm actually not very well verse in this area so question my advice. If you're not working in data that crosses language boundaries then this change is mostly moot.

I haven't seen a solution in D for handling this. I only briefly looked into it for this article. So continue using toLower as was recommended to me for Python.

💖 💪 🙅 🚩
jessekphillips
Jesse Phillips

Posted on September 2, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Parsing a String in D
dlang Parsing a String in D

October 20, 2019

Case Insensitive in D
dlang Case Insensitive in D

September 2, 2019

String Contained in a String in D
dlang String Contained in a String in D

August 25, 2019