Case Insensitive in D

github logo Updated on ・1 min read

Python (13 Part Series)

1) Boolean in D 2) Comments in D 3 ... 11 3) Raise Exceptions in D 4) Add to a List in D 5) Count of a List in D 6) String Contained in a String in D 7) Where did my string go in D 8) Case Insensitive in D 9) Add to a Dictionary in D 10) Check Dictionary has key in D 11) Filter a Dictionary in D 12) Split, Apply, Merge in D 13) Map Reduce 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");

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.

twitter logo DISCUSS
Classic DEV Post from Jan 15

How to Improve Writing Skills as a Non-Native Speaker

Let me begin by saying, that writing a new post either on technical or soft skill topics is always a challenge for me. Why? Because I am not a native English speaker.

Jesse Phillips profile image
Senior Quality Assurance (SDET) starting to establish a larger presence in communities.