[ADT] Add 'consume_front' and 'consume_back' methods to StringRef which
authorChandler Carruth <chandlerc@gmail.com>
Sun, 31 Jul 2016 02:19:13 +0000 (02:19 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 31 Jul 2016 02:19:13 +0000 (02:19 +0000)
commit974c67e7c6101328c3791e560fa187227a525065
tree408707ad1302650258a6b172e72909e99ea17c96
parent5e5501861a268e09bb5307ca41112f91e49bc08d
[ADT] Add 'consume_front' and 'consume_back' methods to StringRef which
are very handy when parsing text.

They are essentially a combination of startswith and a self-modifying
drop_front, or endswith and drop_back respectively.

Differential Revision: https://reviews.llvm.org/D22723

llvm-svn: 277288
llvm/include/llvm/ADT/StringRef.h
llvm/unittests/ADT/StringRefTest.cpp