On locale-aware substring matching, either case-sensitive or case-insensitive It’s surprisingly complicated, but fortunately, somebody has done it for you. Click here to read the article