Add a couple of useful functions to string.c

Summary: These functions are going to be useful in an upcoming diff.

Test Plan: This code is currently unused.

Reviewers: wez

Reviewed By: wez

Differential Revision: https://phabricator.fb.com/D897913

Task ID: 2646666

--HG--
extra : amend_source : fd9173eca9f531c12148063b0d580d31fd9a834d