diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2025-05-12 11:13:38 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2025-05-12 14:31:36 +0200 |
commit | 14ece9f5702909525a9b5814d51c789b714c8bfb (patch) | |
tree | d109f233cdc9e342f83e7c3475973b7e4cf2b91f | |
parent | 40b7e8671779f94894ce2bd4e7eb9b5d41d48c6e (diff) |
startsWith has an optional argument to return the rest
Change-Id: I30cc10122b6d64923a8c87a79fa239eebb1c6c05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185202
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.cxx | 5 |
2 files changed, 3 insertions, 8 deletions
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 4568de7e50c3..0ddf8ee2f468 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -5647,12 +5647,8 @@ void HTMLReader::SetupFilterOptions() return; OUString aFilterOptions = pItem->GetValue(); - static constexpr OUString aXhtmlNsKey(u"xhtmlns="_ustr); - if (aFilterOptions.startsWith(aXhtmlNsKey)) - { - OUString aNamespace = aFilterOptions.copy(aXhtmlNsKey.getLength()); + if (OUString aNamespace; aFilterOptions.startsWith("xhtmlns=", &aNamespace)) m_aNamespace = aNamespace; - } } namespace diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index a458a8607c0d..956641333222 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -231,16 +231,15 @@ void SwHTMLWriter::SetupFilterOptions(std::u16string_view rFilterOptions) const uno::Sequence<OUString> aOptionSeq = comphelper::string::convertCommaSeparated(rFilterOptions); - static constexpr OUString aXhtmlNsKey(u"xhtmlns="_ustr); for (const auto& rOption : aOptionSeq) { if (rOption == "XHTML") { aStoreMap[u"XHTML"_ustr] <<= true; } - else if (rOption.startsWith(aXhtmlNsKey)) + else if (OUString aNamespace; rOption.startsWith("xhtmlns=", &aNamespace)) { - aStoreMap[u"XhtmlNs"_ustr] <<= rOption.copy(aXhtmlNsKey.getLength()); + aStoreMap[u"XhtmlNs"_ustr] <<= aNamespace; } } |