folly: adding folly::ltrimWhitespace / folly::rtrimWhitespace
authorHaim Grosman <haimg@fb.com>
Tue, 2 Jun 2015 00:14:49 +0000 (17:14 -0700)
committerNoam Lerner <noamler@fb.com>
Wed, 3 Jun 2015 16:53:47 +0000 (09:53 -0700)
commit5a2591ef0afd71a3fd6998907fbb06c9385de329
treef1caf03912458196a119e40cc9e32d997e801f24
parentd9e08fac978077172eff085989fe6c018c9fcaca
folly: adding folly::ltrimWhitespace / folly::rtrimWhitespace

Summary:
folly: adding folly::trimWhitespace

extending the idea of folly::skipWhitespace.
the reason for adding it, we want to be able to do:

auto s = skipWhitespace(trimWhitespace(" aaaa "))

very similar to python's strip()

Test Plan:
adding unit tests:

# make ; _bin/folly/test/string_test --gtest_filter="String.whitespace"
# fbmake --ccache off --distcc off dbg -j 16
fbmake dbg -j 16
Fbmake run id: G62i4cDP42U
Note: Google Test filter = String.whitespace
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from String
[ RUN      ] String.whitespace
[       OK ] String.whitespace (0 ms)
[----------] 1 test from String (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[  PASSED  ] 1 test.

Reviewed By: ldbrandy@fb.com

Subscribers: ldbrandy, folly-diffs@, yfeldblum, chalfant, azhavnerchik

FB internal diff: D2109364

Signature: t1:2109364:1433192444:862e237bba1928fcb94be1f95c57a68d457939e9
folly/String.h
folly/StringBase.cpp
folly/test/StringTest.cpp