X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fstr.c;h=45187ef12bbc75a6d108ea4eaa3cbbaf6c58106f;hb=d8b3292a8c12564dbc67e59f24d626dcfbf2e274;hp=811674225c23c9f0f8f757bab266ccae662b7c38;hpb=32538f9f35aee7145a49971f9dae1394a1a201b5;p=pspp diff --git a/src/libpspp/str.c b/src/libpspp/str.c index 811674225c..45187ef12b 100644 --- a/src/libpspp/str.c +++ b/src/libpspp/str.c @@ -615,6 +615,21 @@ ss_match_string (struct substring *ss, const struct substring target) return false; } +/* If SS begins with TARGET, except possibly for case differences, removes it + and returns true. Otherwise, returns false without changing SS. */ +bool +ss_match_string_case (struct substring *ss, const struct substring target) +{ + size_t length = ss_length (target); + if (ss_equals_case (ss_head (*ss, length), target)) + { + ss_advance (ss, length); + return true; + } + else + return false; +} + /* Removes the first byte from SS and returns it. If SS is empty, returns EOF without modifying SS. */ int