Add convenience std::string overload for toLowerAscii v2017.09.11.00
authorGiuseppe Ottaviano <ott@fb.com>
Sun, 10 Sep 2017 16:59:56 +0000 (09:59 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sun, 10 Sep 2017 17:04:56 +0000 (10:04 -0700)
commitd84e6482135417bafed3dea69c29b8d8b8c39970
tree9d4824df3f7492a0b1267d39caa7bcfed96e5de6
parentcb471a45484abbca56128078afa5232b7c1a6448
Add convenience std::string overload for toLowerAscii

Summary:
`toLowerAscii` is surprisingly hard to use with `std::string` because (until C++17) `data()` returns a `const char*`. In addition, it is not widely known that `s[0]` is legal even if the string is empty. This can lead to a variety of suboptimal code, from explicitly checking emptiness, to casting away the `const` (which causes UB).

Let's just have a simple overload for it.

Reviewed By: pixelb, philippv, yfeldblum

Differential Revision: D5801970

fbshipit-source-id: 407e2e9e66147a0662a5e09c75921255adff0702
folly/String.h