diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-29 20:52:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-30 21:21:34 +0200 |
commit | fbff7af0a1a31e82c3a3eb6dac77d5a48ef3371d (patch) | |
tree | 2aad7e48c6f7a260e0c3ebf6799fbfb95bb6a210 /include/comphelper | |
parent | 40077fe30919494f0ecd04c4620cac2334d3d382 (diff) |
split comphelper::string::strip functions into String and view version
which is more obvious, from the perspective of the caller, and lets us
avoid creating a new String if nothing needs to be stripped
Change-Id: I66a980eaf4aa818251bec49bdb16c2dddb0745e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133657
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/comphelper')
-rw-r--r-- | include/comphelper/string.hxx | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx index 82815c0e5bc6..4fe10b71b3f0 100644 --- a/include/comphelper/string.hxx +++ b/include/comphelper/string.hxx @@ -69,7 +69,9 @@ inline OUStringBuffer& remove(OUStringBuffer &rIn, @return The resulting OString */ -COMPHELPER_DLLPUBLIC OString stripStart(std::string_view rIn, +COMPHELPER_DLLPUBLIC OString stripStart(const OString& rIn, + char c); +COMPHELPER_DLLPUBLIC std::string_view stripStart(std::string_view rIn, char c); /** Strips occurrences of a character from the start of the source string @@ -79,7 +81,9 @@ COMPHELPER_DLLPUBLIC OString stripStart(std::string_view rIn, @return The resulting OUString */ -COMPHELPER_DLLPUBLIC OUString stripStart(std::u16string_view rIn, +COMPHELPER_DLLPUBLIC OUString stripStart(const OUString& rIn, + sal_Unicode c); +COMPHELPER_DLLPUBLIC std::u16string_view stripStart(std::u16string_view rIn, sal_Unicode c); /** Strips occurrences of a character from the end of the source string @@ -89,7 +93,9 @@ COMPHELPER_DLLPUBLIC OUString stripStart(std::u16string_view rIn, @return The resulting OString */ -COMPHELPER_DLLPUBLIC OString stripEnd(std::string_view rIn, +COMPHELPER_DLLPUBLIC OString stripEnd(const OString& rIn, + char c); +COMPHELPER_DLLPUBLIC std::string_view stripEnd(std::string_view rIn, char c); /** Strips occurrences of a character from the end of the source string @@ -99,7 +105,9 @@ COMPHELPER_DLLPUBLIC OString stripEnd(std::string_view rIn, @return The resulting OUString */ -COMPHELPER_DLLPUBLIC OUString stripEnd(std::u16string_view rIn, +COMPHELPER_DLLPUBLIC OUString stripEnd(const OUString& rIn, + sal_Unicode c); +COMPHELPER_DLLPUBLIC std::u16string_view stripEnd(std::u16string_view rIn, sal_Unicode c); /** Strips occurrences of a character from the start and end of the source string @@ -109,7 +117,9 @@ COMPHELPER_DLLPUBLIC OUString stripEnd(std::u16string_view rIn, @return The resulting OString */ -COMPHELPER_DLLPUBLIC OString strip(std::string_view rIn, +COMPHELPER_DLLPUBLIC OString strip(const OString& rIn, + char c); +COMPHELPER_DLLPUBLIC std::string_view strip(std::string_view rIn, char c); /** Strips occurrences of a character from the start and end of the source string @@ -119,7 +129,9 @@ COMPHELPER_DLLPUBLIC OString strip(std::string_view rIn, @return The resulting OUString */ -COMPHELPER_DLLPUBLIC OUString strip(std::u16string_view rIn, +COMPHELPER_DLLPUBLIC OUString strip(const OUString& rIn, + sal_Unicode c); +COMPHELPER_DLLPUBLIC std::u16string_view strip(std::u16string_view rIn, sal_Unicode c); /** Returns number of tokens in an OUString |