basic/source/uno/namecont.cxx                        |    2 
 codemaker/source/commoncpp/commoncpp.cxx             |    5 
 comphelper/source/misc/storagehelper.cxx             |    2 
 cui/source/tabpages/numpages.cxx                     |    4 
 cui/source/tabpages/tpline.cxx                       |    7 
 framework/source/uielement/toolbarwrapper.cxx        |    6 
 include/rtl/string.hxx                               |  382 +++++++++++++++
 include/rtl/ustring.hxx                              |  463 ++++++++++++++++++-
 oox/source/vml/vmlshape.cxx                          |    4 
 oox/source/vml/vmlshapecontext.cxx                   |    4 
 sd/source/ui/dlg/BulletAndPositionDlg.cxx            |    6 
 sfx2/source/appl/sfxhelp.cxx                         |    2 
 sfx2/source/sidebar/SidebarController.cxx            |    9 
 stoc/source/inspect/introspection.cxx                |   14 
 svx/source/form/datanavi.cxx                         |    4 
 svx/source/tbxctrls/Palette.cxx                      |    2 
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |    4 
 ucb/source/ucp/cmis/cmis_url.cxx                     |    4 
 ucb/source/ucp/webdav-curl/CurlSession.cxx           |   19 
 vcl/source/edit/textview.cxx                         |    4 
 vcl/source/filter/ipdf/pdfdocument.cxx               |    6 
 vcl/source/window/builder.cxx                        |    6 
 vcl/unx/generic/printer/ppdparser.cxx                |    4 
 xmlhelp/source/cxxhelp/provider/databases.cxx        |    2 
 xmloff/source/draw/animationexport.cxx               |    5 
 25 files changed, 881 insertions(+), 89 deletions(-)

New commits:
commit 1bbcc3fdf312971ffb681b332f47369739d95dde
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue May 14 14:56:47 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Jul 25 13:29:11 2024 +0200

    O[U]String overloads that return view for rest parameter
    
    Add new overloads to OUString methods that have a
    "OUString* rest" style parameter.
    
    Instead return a view, which does not require allocation.
    
    To avoid overload ambiguity, split the methods into
    different variants that do not use default parameters.
    
    Change-Id: I1aa366115750f1f7ea4fe665804195f59f7c4b69
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167632
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 3646fd140ceb..0edefa1676aa 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -1279,7 +1279,7 @@ void SfxLibraryContainer::checkStorageURL( const 
OUString& aSourceURL,
     else
     {
         // try to re-create the variable URL: helps moving the profile
-        if (OUString aRest; 
aSourceURL.startsWith(expand_url(sUserBasicVariablePrefix), &aRest))
+        if (std::u16string_view aRest; 
aSourceURL.startsWith(expand_url(sUserBasicVariablePrefix), &aRest))
             aUnexpandedStorageURL = sUserBasicVariablePrefix + aRest;
         else if (aSourceURL.startsWith(expand_url(sInstBasicVariablePrefix), 
&aRest))
             aUnexpandedStorageURL = sInstBasicVariablePrefix + aRest;
diff --git a/codemaker/source/commoncpp/commoncpp.cxx 
b/codemaker/source/commoncpp/commoncpp.cxx
index a47a8d99526b..a99575af7224 100644
--- a/codemaker/source/commoncpp/commoncpp.cxx
+++ b/codemaker/source/commoncpp/commoncpp.cxx
@@ -55,9 +55,10 @@ OString scopedCppName(OString const & type, bool ns_alias)
     } while( nPos != -1 );
 
     OString s(tmpBuf.makeStringAndClear());
-    if (ns_alias && s.startsWith("::com::sun::star::", &s))
+    std::string_view rest;
+    if (ns_alias && s.startsWith("::com::sun::star::", &rest))
     {
-        s = "::css::" + s; // nicer shorthand
+        s = OString::Concat("::css::") + rest; // nicer shorthand
     }
 
     return s;
diff --git a/comphelper/source/misc/storagehelper.cxx 
b/comphelper/source/misc/storagehelper.cxx
index df74a6330a58..8d7786205d79 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -704,7 +704,7 @@ uno::Reference< io::XStream > 
OStorageHelper::GetStreamAtPackageURL(
         const OUString& rURL, sal_uInt32 const nOpenMode,
         LifecycleProxy const & rNastiness)
 {
-    OUString path;
+    std::u16string_view path;
     if (rURL.startsWithIgnoreAsciiCase("vnd.sun.star.Package:", &path))
     {
         return GetStreamAtPath(xParentStorage, path, nOpenMode, rNastiness);
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 6a838d001772..240711ffca10 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1940,10 +1940,10 @@ IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const 
OUString&, rIdent, void)
     bool                bSucc(false);
     SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_CUISTR_EDIT_GRAPHIC), 
GetFrameWeld());
 
-    OUString sNumber;
+    std::u16string_view sNumber;
     if (rIdent.startsWith("gallery", &sNumber))
     {
-        auto idx = sNumber.toUInt32();
+        auto idx = o3tl::toUInt32(sNumber);
         if (idx < aGrfNames.size())
         {
             aGrfName = aGrfNames[idx];
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index f07ca7a3497c..b525cb3621df 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -63,6 +63,7 @@
 #include <cuitabarea.hxx>
 #include <svtools/unitconv.hxx>
 #include <comphelper/lok.hxx>
+#include <o3tl/string_view.hxx>
 
 #define MAX_BMP_WIDTH   16
 #define MAX_BMP_HEIGHT  16
@@ -1527,16 +1528,16 @@ IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const 
OUString&, rIdent, void)
     bool bEnable = true;
     tools::Long nPreviousSymbolType = m_nSymbolType;
 
-    OUString sNumber;
+    std::u16string_view sNumber;
     if (rIdent.startsWith("gallery", &sNumber))
     {
-        SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[sNumber.toUInt32()].get();
+        SvxBmpItemInfo* pInfo = 
m_aGalleryBrushItems[o3tl::toUInt32(sNumber)].get();
         pGraphic = pInfo->pBrushItem->GetGraphic();
         m_nSymbolType = SVX_SYMBOLTYPE_BRUSHITEM;
     }
     else if (rIdent.startsWith("symbol", &sNumber))
     {
-        m_nSymbolType = sNumber.toUInt32();
+        m_nSymbolType = o3tl::toUInt32(sNumber);
         SvxBmpItemInfo* pInfo = m_aSymbolBrushItems[m_nSymbolType].get();
         pGraphic = pInfo->pBrushItem->GetGraphic();
     }
diff --git a/framework/source/uielement/toolbarwrapper.cxx 
b/framework/source/uielement/toolbarwrapper.cxx
index 093367316cb4..09381a79ead2 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -120,8 +120,8 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< 
Any >& aArguments )
     if ( !(xFrame.is() && m_xConfigSource.is()) )
         return;
 
-    OUString aContextPart;
-    if ( m_aResourceURL.startsWith( "private:resource/toolbar/singlemode", 
&aContextPart ) && aContextPart.isEmpty() )
+    std::u16string_view aContextPart;
+    if ( m_aResourceURL.startsWith( "private:resource/toolbar/singlemode", 
&aContextPart ) && aContextPart.empty() )
     {
         auto xMultiplexer( ContextChangeEventMultiplexer::get( m_xContext ) );
         try
@@ -138,7 +138,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< 
Any >& aArguments )
     // Create VCL based toolbar which will be filled with settings data
     VclPtr<ToolBox> pToolBar;
     rtl::Reference<ToolBarManager> pToolBarManager;
-    if ( aContextPart.isEmpty() )
+    if ( aContextPart.empty() )
     {
         SolarMutexGuard aSolarMutexGuard;
         if ( !xParentWindow.is() )
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx
index d9a5bf3c3bac..a62a33e2f590 100644
--- a/include/rtl/string.hxx
+++ b/include/rtl/string.hxx
@@ -1059,29 +1059,77 @@ public:
             == 0;
     }
 
+#if defined LIBO_INTERNAL_ONLY
     /**
       Check whether this string starts with a given substring.
 
       @param str the substring to be compared
 
-      @param rest if non-null, and this function returns true, then assign a
-      copy of the remainder of this string to *rest. Available since
-      LibreOffice 4.2
+      @return true if and only if the given str appears as a substring at the
+      start of this string
+
+      @since LibreOffice 4.0
+    */
+    bool startsWith(std::string_view str) const {
+        return match(str);
+    }
+    /**
+      Check whether this string starts with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
+      copy of the remainder of this string to *rest.
 
       @return true if and only if the given str appears as a substring at the
       start of this string
 
       @since LibreOffice 4.0
     */
-#if defined LIBO_INTERNAL_ONLY
-    bool startsWith(std::string_view str, OString * rest = NULL) const {
+    bool startsWith(std::string_view str, OString * rest) const {
+        assert(rest);
         bool b = match(str);
-        if (b && rest != NULL) {
+        if (b) {
             *rest = copy(str.size());
         }
         return b;
     }
+    /**
+      Check whether this string starts with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
+      copy of the remainder of this string to *rest.
+
+      @return true if and only if the given str appears as a substring at the
+      start of this string
+
+      @since LibreOffice 24.2
+    */
+    bool startsWith(std::string_view str, std::string_view * rest) const {
+        assert(rest);
+        bool b = match(str);
+        if (b) {
+            *rest = subView(str.size());
+        }
+        return b;
+    }
 #else
+    /**
+      Check whether this string starts with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if non-null, and this function returns true, then assign a
+      copy of the remainder of this string to *rest. Available since
+      LibreOffice 4.2
+
+      @return true if and only if the given str appears as a substring at the
+      start of this string
+
+      @since LibreOffice 4.0
+    */
     bool startsWith(OString const & str, OString * rest = NULL) const {
         bool b = match(str);
         if (b && rest != NULL) {
@@ -1091,6 +1139,55 @@ public:
     }
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 4.0
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type 
startsWith(
+        T & literal) const
+    {
+        RTL_STRING_CONST_FUNCTION
+        return match(literal, 0);
+    }
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 4.0
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type 
startsWith(
+        T & literal, OString * rest) const
+    {
+        RTL_STRING_CONST_FUNCTION
+        assert(rest);
+        bool b = match(literal, 0);
+        if (b) {
+            *rest = copy(
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        }
+        return b;
+    }
+    /**
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 25.2
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type 
startsWith(
+        T & literal, std::string_view * rest) const
+    {
+        RTL_STRING_CONST_FUNCTION
+        assert(rest);
+        bool b = match(literal, 0);
+        if (b) {
+            *rest = subView(
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        }
+        return b;
+    }
+#else
     /**
      @overload
      This function accepts an ASCII string literal as its argument.
@@ -1108,7 +1205,9 @@ public:
         }
         return b;
     }
+#endif
 
+#if defined LIBO_INTERNAL_ONLY
     /**
       Check whether this string starts with a given string, ignoring the case 
of
       ASCII letters.
@@ -1119,7 +1218,28 @@ public:
 
       @param str the substring to be compared
 
-      @param rest if non-null, and this function returns true, then assign a
+      @return true if and only if the given str appears as a substring at the
+      start of this string, ignoring the case of ASCII letters ("A"--"Z" and
+      "a"--"z")
+
+      @since LibreOffice 5.1
+    */
+    bool startsWithIgnoreAsciiCase(std::string_view str)
+        const
+    {
+        return matchIgnoreAsciiCase(str);
+    }
+    /**
+      Check whether this string starts with a given string, ignoring the case 
of
+      ASCII letters.
+
+      Character values between 65 and 90 (ASCII A-Z) are interpreted as
+      values between 97 and 122 (ASCII a-z).
+      This function can't be used for language specific comparison.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
       copy of the remainder of this string to *rest.
 
       @return true if and only if the given str appears as a substring at the
@@ -1128,17 +1248,65 @@ public:
 
       @since LibreOffice 5.1
     */
-#if defined LIBO_INTERNAL_ONLY
-    bool startsWithIgnoreAsciiCase(std::string_view str, OString * rest = NULL)
+    bool startsWithIgnoreAsciiCase(std::string_view str, OString * rest)
         const
     {
+        assert(rest);
         bool b = matchIgnoreAsciiCase(str);
-        if (b && rest != NULL) {
+        if (b) {
             *rest = copy(str.size());
         }
         return b;
     }
+    /**
+      Check whether this string starts with a given string, ignoring the case 
of
+      ASCII letters.
+
+      Character values between 65 and 90 (ASCII A-Z) are interpreted as
+      values between 97 and 122 (ASCII a-z).
+      This function can't be used for language specific comparison.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
+      copy of the remainder of this string to *rest.
+
+      @return true if and only if the given str appears as a substring at the
+      start of this string, ignoring the case of ASCII letters ("A"--"Z" and
+      "a"--"z")
+
+      @since LibreOffice 24.2
+    */
+    bool startsWithIgnoreAsciiCase(std::string_view str, std::string_view * 
rest)
+        const
+    {
+        assert(rest);
+        bool b = matchIgnoreAsciiCase(str);
+        if (b) {
+            *rest = subView(str.size());
+        }
+        return b;
+    }
 #else
+    /**
+      Check whether this string starts with a given string, ignoring the case 
of
+      ASCII letters.
+
+      Character values between 65 and 90 (ASCII A-Z) are interpreted as
+      values between 97 and 122 (ASCII a-z).
+      This function can't be used for language specific comparison.
+
+      @param str the substring to be compared
+
+      @param rest if non-null, and this function returns true, then assign a
+      copy of the remainder of this string to *rest.
+
+      @return true if and only if the given str appears as a substring at the
+      start of this string, ignoring the case of ASCII letters ("A"--"Z" and
+      "a"--"z")
+
+      @since LibreOffice 5.1
+    */
     bool startsWithIgnoreAsciiCase(OString const & str, OString * rest = NULL)
         const
     {
@@ -1150,6 +1318,57 @@ public:
     }
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 5.1
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    startsWithIgnoreAsciiCase(T & literal) const
+    {
+        RTL_STRING_CONST_FUNCTION
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        return matchIgnoreAsciiCase(literal);
+    }
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 5.1
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    startsWithIgnoreAsciiCase(T & literal, OString * rest) const
+    {
+        RTL_STRING_CONST_FUNCTION
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b = matchIgnoreAsciiCase(literal);
+        if (b) {
+            *rest = copy(
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        }
+        return b;
+    }
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    startsWithIgnoreAsciiCase(T & literal, std::string_view * rest) const
+    {
+        RTL_STRING_CONST_FUNCTION
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b = matchIgnoreAsciiCase(literal);
+        if (b) {
+            *rest = subView(
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        }
+        return b;
+    }
+#else
     /**
      @overload
      This function accepts an ASCII string literal as its argument.
@@ -1169,13 +1388,29 @@ public:
         }
         return b;
     }
+#endif
 
+#if defined LIBO_INTERNAL_ONLY
     /**
       Check whether this string ends with a given substring.
 
       @param str the substring to be compared
 
-      @param rest if non-null, and this function returns true, then assign a
+      @return true if and only if the given str appears as a substring at the
+      end of this string
+
+      @since LibreOffice 3.6
+    */
+    bool endsWith(std::string_view str) const {
+        return str.size() <= sal_uInt32(getLength())
+            && match(str, getLength() - str.size());
+    }
+    /**
+      Check whether this string ends with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
       copy of the remainder of this string to *rest. Available since
       LibreOffice 4.2
 
@@ -1184,16 +1419,52 @@ public:
 
       @since LibreOffice 3.6
     */
-#if defined LIBO_INTERNAL_ONLY
-    bool endsWith(std::string_view str, OString * rest = NULL) const {
+    bool endsWith(std::string_view str, OString * rest) const {
+        assert(rest);
         bool b = str.size() <= sal_uInt32(getLength())
             && match(str, getLength() - str.size());
-        if (b && rest != NULL) {
+        if (b) {
             *rest = copy(0, getLength() - str.size());
         }
         return b;
     }
+    /**
+      Check whether this string ends with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
+      copy of the remainder of this string to *rest.
+
+      @return true if and only if the given str appears as a substring at the
+      end of this string
+
+      @since LibreOffice 24.2
+    */
+    bool endsWith(std::string_view str, std::string_view * rest) const {
+        assert(rest);
+        bool b = str.size() <= sal_uInt32(getLength())
+            && match(str, getLength() - str.size());
+        if (b) {
+            *rest = subView(0, getLength() - str.size());
+        }
+        return b;
+    }
 #else
+    /**
+      Check whether this string ends with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if non-null, and this function returns true, then assign a
+      copy of the remainder of this string to *rest. Available since
+      LibreOffice 4.2
+
+      @return true if and only if the given str appears as a substring at the
+      end of this string
+
+      @since LibreOffice 3.6
+    */
     bool endsWith(OString const & str, OString * rest = NULL) const {
         bool b = str.getLength() <= getLength()
             && match(str, getLength() - str.getLength());
@@ -1204,6 +1475,88 @@ public:
     }
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 25.2
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type 
endsWith(
+        T & literal) const
+    {
+        RTL_STRING_CONST_FUNCTION
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(getLength()))
+            && match(
+                libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                    literal),
+                (getLength()
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length));
+        return b;
+    }
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 3.6
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type 
endsWith(
+        T & literal, OString * rest) const
+    {
+        RTL_STRING_CONST_FUNCTION
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(getLength()))
+            && match(
+                libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                    literal),
+                (getLength()
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length));
+        if (b) {
+            *rest = copy(
+                0,
+                (getLength()
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length));
+        }
+        return b;
+    }
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 25.2
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type 
endsWith(
+        T & literal, std::string_view * rest) const
+    {
+        RTL_STRING_CONST_FUNCTION
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(getLength()))
+            && match(
+                libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                    literal),
+                (getLength()
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length));
+        if (b) {
+            *rest = subView(
+                0,
+                (getLength()
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length));
+        }
+        return b;
+    }
+#else
     /**
      @overload
      This function accepts an ASCII string literal as its argument.
@@ -1232,6 +1585,7 @@ public:
         }
         return b;
     }
+#endif
 
     /**
       Check whether this string ends with a given substring.
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index 39567014c395..aeab698c8238 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -1446,12 +1446,26 @@ public:
         const;
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
     /**
       Check whether this string starts with a given substring.
 
       @param str the substring to be compared
 
-      @param rest if non-null, and this function returns true, then assign a
+      @return true if and only if the given str appears as a substring at the
+      start of this string
+
+      @since LibreOffice 4.0
+    */
+    bool startsWith(std::u16string_view sv) const {
+        return match(sv);
+    }
+    /**
+      Check whether this string starts with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
       copy of the remainder of this string to *rest. Available since
       LibreOffice 4.2
 
@@ -1460,15 +1474,50 @@ public:
 
       @since LibreOffice 4.0
     */
-#if defined LIBO_INTERNAL_ONLY
-    bool startsWith(std::u16string_view sv, OUString * rest = nullptr) const {
+    bool startsWith(std::u16string_view sv, OUString * rest) const {
+        assert(rest);
         auto const b = match(sv);
-        if (b && rest != nullptr) {
+        if (b) {
             *rest = copy(sv.size());
         }
         return b;
     }
+    /**
+      Check whether this string starts with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
+      copy of the remainder of this string to *rest.
+
+      @return true if and only if the given str appears as a substring at the
+      start of this string
+
+      @since LibreOffice 24.2
+    */
+    bool startsWith(std::u16string_view sv, std::u16string_view * rest) const {
+        assert(rest);
+        auto const b = match(sv);
+        if (b) {
+            *rest = subView(sv.size());
+        }
+        return b;
+    }
 #else
+    /**
+      Check whether this string starts with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if non-null, and this function returns true, then assign a
+      copy of the remainder of this string to *rest. Available since
+      LibreOffice 4.2
+
+      @return true if and only if the given str appears as a substring at the
+      start of this string
+
+      @since LibreOffice 4.0
+    */
     bool startsWith(OUString const & str, OUString * rest = NULL) const {
         bool b = match(str);
         if (b && rest != NULL) {
@@ -1478,6 +1527,79 @@ public:
     }
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
+    /**
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 25.2
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type 
startsWith(
+        T & literal) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && rtl_ustr_asciil_reverseEquals_WithLength(
+                pData->buffer,
+                libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                    literal),
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        return b;
+    }
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 4.0
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type 
startsWith(
+        T & literal, OUString * rest) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && rtl_ustr_asciil_reverseEquals_WithLength(
+                pData->buffer,
+                libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                    literal),
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        if (b) {
+            *rest = copy(
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        }
+        return b;
+    }
+    /**
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 25.2
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type 
startsWith(
+        T & literal, std::u16string_view * rest) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && rtl_ustr_asciil_reverseEquals_WithLength(
+                pData->buffer,
+                libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                    literal),
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        if (b) {
+            *rest = subView(
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        }
+        return b;
+    }
+#else
     /**
      @overload
      This function accepts an ASCII string literal as its argument.
@@ -1503,6 +1625,7 @@ public:
         }
         return b;
     }
+#endif
 
     /**
       Check whether this string starts with a given string, ignoring the case 
of
@@ -1525,13 +1648,25 @@ public:
       @since LibreOffice 4.0
     */
 #if defined LIBO_INTERNAL_ONLY
-    bool startsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest = 
nullptr) const {
+    bool startsWithIgnoreAsciiCase(std::u16string_view sv) const {
+        return matchIgnoreAsciiCase(sv);
+    }
+    bool startsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest) 
const {
+        assert(rest);
         auto const b = matchIgnoreAsciiCase(sv);
-        if (b && rest != nullptr) {
+        if (b) {
             *rest = copy(sv.size());
         }
         return b;
     }
+    bool startsWithIgnoreAsciiCase(std::u16string_view sv, std::u16string_view 
* rest) const {
+        assert(rest);
+        auto const b = matchIgnoreAsciiCase(sv);
+        if (b) {
+            *rest = subView(sv.size());
+        }
+        return b;
+    }
 #else
     bool startsWithIgnoreAsciiCase(OUString const & str, OUString * rest = 
NULL)
         const
@@ -1544,6 +1679,86 @@ public:
     }
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 4.0
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    startsWithIgnoreAsciiCase(T & literal) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+                   pData->buffer,
+                   libreoffice_internal::ConstCharArrayDetector<T>::length,
+                   libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                       literal),
+                   libreoffice_internal::ConstCharArrayDetector<T>::length)
+               == 0);
+        return b;
+    }
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 4.0
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    startsWithIgnoreAsciiCase(T & literal, OUString * rest) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+                   pData->buffer,
+                   libreoffice_internal::ConstCharArrayDetector<T>::length,
+                   libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                       literal),
+                   libreoffice_internal::ConstCharArrayDetector<T>::length)
+               == 0);
+        if (b) {
+            *rest = copy(
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        }
+        return b;
+    }
+    /**
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 24.2
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    startsWithIgnoreAsciiCase(T & literal, std::u16string_view * rest) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+                   pData->buffer,
+                   libreoffice_internal::ConstCharArrayDetector<T>::length,
+                   libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                       literal),
+                   libreoffice_internal::ConstCharArrayDetector<T>::length)
+               == 0);
+        if (b) {
+            *rest = subView(
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        }
+        return b;
+    }
+#else
     /**
      @overload
      This function accepts an ASCII string literal as its argument.
@@ -1571,23 +1786,24 @@ public:
         }
         return b;
     }
+#endif
 
+#if defined LIBO_INTERNAL_ONLY
     /**
       Check whether this string ends with a given substring.
 
       @param str the substring to be compared
 
-      @param rest if non-null, and this function returns true, then assign a
-      copy of the remainder of this string to *rest. Available since
-      LibreOffice 4.2
-
       @return true if and only if the given str appears as a substring at the
       end of this string
 
       @since LibreOffice 3.6
     */
-#if defined LIBO_INTERNAL_ONLY
-    bool endsWith(std::u16string_view sv, OUString * rest = nullptr) const {
+    bool endsWith(std::u16string_view sv) const {
+        return sv.size() <= sal_uInt32(pData->length)
+            && match(sv, pData->length - sv.size());
+    }
+    bool endsWith(std::u16string_view sv, OUString * rest) const {
         auto const b = sv.size() <= sal_uInt32(pData->length)
             && match(sv, pData->length - sv.size());
         if (b && rest != nullptr) {
@@ -1595,7 +1811,43 @@ public:
         }
         return b;
     }
+    /**
+      Check whether this string ends with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
+      copy of the remainder of this string to *rest.
+
+      @return true if and only if the given str appears as a substring at the
+      end of this string
+
+      @since LibreOffice 24.2
+    */
+    bool endsWith(std::u16string_view sv, std::u16string_view * rest) const {
+        assert(rest);
+        auto const b = sv.size() <= sal_uInt32(pData->length)
+            && match(sv, pData->length - sv.size());
+        if (b) {
+            *rest = subView(0, (pData->length - sv.size()));
+        }
+        return b;
+    }
 #else
+    /**
+      Check whether this string ends with a given substring.
+
+      @param str the substring to be compared
+
+      @param rest if non-null, and this function returns true, then assign a
+      copy of the remainder of this string to *rest. Available since
+      LibreOffice 4.2
+
+      @return true if and only if the given str appears as a substring at the
+      end of this string
+
+      @since LibreOffice 3.6
+    */
     bool endsWith(OUString const & str, OUString * rest = NULL) const {
         bool b = str.getLength() <= getLength()
             && match(str, getLength() - str.getLength());
@@ -1606,6 +1858,78 @@ public:
     }
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
+    /**
+     @overload
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 25.2
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    endsWith(T & literal) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && rtl_ustr_asciil_reverseEquals_WithLength(
+                (pData->buffer + pData->length
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length),
+                libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                    literal),
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        return b;
+    }
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    endsWith(T & literal, OUString * rest) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && rtl_ustr_asciil_reverseEquals_WithLength(
+                (pData->buffer + pData->length
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length),
+                libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                    literal),
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        if (b) {
+            *rest = copy(
+                0,
+                (getLength()
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length));
+        }
+        return b;
+    }
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    endsWith(T & literal, std::u16string_view * rest) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && rtl_ustr_asciil_reverseEquals_WithLength(
+                (pData->buffer + pData->length
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length),
+                libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                    literal),
+                libreoffice_internal::ConstCharArrayDetector<T>::length);
+        if (b) {
+            *rest = subView(
+                0,
+                (getLength()
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length));
+        }
+        return b;
+    }
+#else
     /**
      @overload
      This function accepts an ASCII string literal as its argument.
@@ -1634,6 +1958,7 @@ public:
         }
         return b;
     }
+#endif
 
     /**
       Check whether this string ends with a given ASCII string.
@@ -1655,6 +1980,7 @@ public:
                 asciiStrLength);
     }
 
+#if defined LIBO_INTERNAL_ONLY
     /**
       Check whether this string ends with a given string, ignoring the case of
       ASCII letters.
@@ -1665,7 +1991,7 @@ public:
 
       @param str the substring to be compared
 
-      @param rest if non-null, and this function returns true, then assign a
+      @param rest if this function returns true, then assign a
       copy of the remainder of this string to *rest. Available since
       LibreOffice 4.2
 
@@ -1675,8 +2001,11 @@ public:
 
       @since LibreOffice 3.6
     */
-#if defined LIBO_INTERNAL_ONLY
-    bool endsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest = 
nullptr) const {
+    bool endsWithIgnoreAsciiCase(std::u16string_view sv) const {
+        return sv.size() <= sal_uInt32(pData->length)
+            && matchIgnoreAsciiCase(sv, pData->length - sv.size());
+    }
+    bool endsWithIgnoreAsciiCase(std::u16string_view sv, OUString * rest) 
const {
         auto const b = sv.size() <= sal_uInt32(pData->length)
             && matchIgnoreAsciiCase(sv, pData->length - sv.size());
         if (b && rest != nullptr) {
@@ -1684,7 +2013,55 @@ public:
         }
         return b;
     }
+    /**
+      Check whether this string ends with a given string, ignoring the case of
+      ASCII letters.
+
+      Character values between 65 and 90 (ASCII A-Z) are interpreted as
+      values between 97 and 122 (ASCII a-z).
+      This function can't be used for language specific comparison.
+
+      @param str the substring to be compared
+
+      @param rest if this function returns true, then assign a
+      copy of the remainder of this string to *rest.
+
+      @return true if and only if the given str appears as a substring at the
+      end of this string, ignoring the case of ASCII letters ("A"--"Z" and
+      "a"--"z")
+
+      @since LibreOffice 24.2
+    */
+    bool endsWithIgnoreAsciiCase(std::u16string_view sv, std::u16string_view * 
rest) const {
+        assert(rest);
+        auto const b = sv.size() <= sal_uInt32(pData->length)
+            && matchIgnoreAsciiCase(sv, pData->length - sv.size());
+        if (b) {
+            *rest = subView(0, pData->length - sv.size());
+        }
+        return b;
+    }
 #else
+    /**
+      Check whether this string ends with a given string, ignoring the case of
+      ASCII letters.
+
+      Character values between 65 and 90 (ASCII A-Z) are interpreted as
+      values between 97 and 122 (ASCII a-z).
+      This function can't be used for language specific comparison.
+
+      @param str the substring to be compared
+
+      @param rest if non-null, and this function returns true, then assign a
+      copy of the remainder of this string to *rest. Available since
+      LibreOffice 4.2
+
+      @return true if and only if the given str appears as a substring at the
+      end of this string, ignoring the case of ASCII letters ("A"--"Z" and
+      "a"--"z")
+
+      @since LibreOffice 3.6
+    */
     bool endsWithIgnoreAsciiCase(OUString const & str, OUString * rest = NULL) 
const
     {
         bool b =  str.getLength() <= getLength()
@@ -1696,6 +2073,61 @@ public:
     }
 #endif
 
+#if defined LIBO_INTERNAL_ONLY
+    /**
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 24.2
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    endsWithIgnoreAsciiCase(T & literal) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+                    (pData->buffer + pData->length
+                     - 
libreoffice_internal::ConstCharArrayDetector<T>::length),
+                    libreoffice_internal::ConstCharArrayDetector<T>::length,
+                    libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                        literal),
+                    libreoffice_internal::ConstCharArrayDetector<T>::length)
+                == 0);
+        return b;
+    }
+    /**
+     This function accepts an ASCII string literal as its argument.
+     @since LibreOffice 24.2
+    */
+    template< typename T >
+    typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type
+    endsWithIgnoreAsciiCase(T & literal, std::u16string_view * rest) const
+    {
+        assert(
+            libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
+        assert(rest);
+        bool b
+            = (libreoffice_internal::ConstCharArrayDetector<T>::length
+               <= sal_uInt32(pData->length))
+            && (rtl_ustr_ascii_compareIgnoreAsciiCase_WithLengths(
+                    (pData->buffer + pData->length
+                     - 
libreoffice_internal::ConstCharArrayDetector<T>::length),
+                    libreoffice_internal::ConstCharArrayDetector<T>::length,
+                    libreoffice_internal::ConstCharArrayDetector<T>::toPointer(
+                        literal),
+                    libreoffice_internal::ConstCharArrayDetector<T>::length)
+                == 0);
+        if (b) {
+            *rest = subView(
+                0,
+                (getLength()
+                 - libreoffice_internal::ConstCharArrayDetector<T>::length));
+        }
+        return b;
+    }
+#else
     /**
      @overload
      This function accepts an ASCII string literal as its argument.
@@ -1726,6 +2158,7 @@ public:
         }
         return b;
     }
+#endif
 
     /**
       Check whether this string ends with a given ASCII string, ignoring the
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d0e77512ceeb..ef177576c342 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -313,12 +313,12 @@ void ShapeBase::finalizeFragmentImport()
         // Temporary fix, shapetype not found if referenced from different 
substream
         // FIXME: extend scope of ShapeContainer to store all shapetypes from 
the document
         static constexpr OUString sShapeTypePrefix = u"shapetype_"_ustr;
-        OUString tmp;
+        std::u16string_view tmp;
         if (aType.startsWith(sShapeTypePrefix)) {
             maTypeModel.moShapeType = 
o3tl::toInt32(aType.subView(sShapeTypePrefix.getLength()));
         }
         else if (aType.startsWith("_x0000_t", &tmp)) {
-            maTypeModel.moShapeType = tmp.toInt32();
+            maTypeModel.moShapeType = o3tl::toInt32(tmp);
         }
     }
 }
diff --git a/oox/source/vml/vmlshapecontext.cxx 
b/oox/source/vml/vmlshapecontext.cxx
index fb009020bf72..daedc527f465 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -297,7 +297,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper 
const & rParent,
         mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() );
         // get ShapeType and ShapeId from name for compatibility
         static constexpr OUString sShapeTypePrefix = u"shapetype_"_ustr;
-        OUString tmp;
+        std::u16string_view tmp;
         if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) )
         {
             mrTypeModel.maShapeId = mrTypeModel.maShapeName;
@@ -306,7 +306,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper 
const & rParent,
         else if (mrTypeModel.maShapeName.startsWith("_x0000_t", &tmp))
         {
             mrTypeModel.maShapeId = mrTypeModel.maShapeName;
-            mrTypeModel.moShapeType = tmp.toInt32();
+            mrTypeModel.moShapeType = o3tl::toInt32(tmp);
         }
     }
 
diff --git a/sd/source/ui/dlg/BulletAndPositionDlg.cxx 
b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
index 5c3724561975..abf2563815c7 100644
--- a/sd/source/ui/dlg/BulletAndPositionDlg.cxx
+++ b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
@@ -47,7 +47,7 @@
 #include <BulletAndPositionDlg.hxx>
 #include <sdresid.hxx>
 #include <DrawViewShell.hxx>
-
+#include <o3tl/string_view.hxx>
 #include <bitmaps.hlst>
 
 #define SHOW_NUMBERING 0
@@ -815,10 +815,10 @@ IMPL_LINK(SvxBulletAndPositionDlg, GraphicHdl_Impl, const 
OUString&, rIdent, voi
     bool bSucc(false);
     SvxOpenGraphicDialog aGrfDlg(SdResId(RID_SVXSTR_EDIT_GRAPHIC), p_Window);
 
-    OUString sNumber;
+    std::u16string_view sNumber;
     if (rIdent.startsWith("gallery", &sNumber))
     {
-        auto idx = sNumber.toUInt32();
+        auto idx = o3tl::toUInt32(sNumber);
         if (idx < aGrfNames.size())
         {
             aGrfName = aGrfNames[idx];
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index f7612c6da0cd..851d3b9f5307 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -784,7 +784,7 @@ bool rewriteFlatpakHelpRootUrl(OUString * helpRootUrl) {
             }
             ini.close();
             // Extract <sha> from 
...;org.libreoffice.LibreOffice.Help=<sha>;...:
-            OUString sha;
+            std::u16string_view sha;
             for (sal_Int32 i = 0;;) {
                 OUString elem = extensions.getToken(0, ';', i);
                 if (elem.startsWith("org.libreoffice.LibreOffice.Help=", 
&sha)) {
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index bdca4a89055c..e421e957f960 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -53,6 +53,7 @@
 #include <sal/log.hxx>
 #include <officecfg/Office/UI/Sidebar.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <o3tl/string_view.hxx>
 
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
@@ -1154,11 +1155,11 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, const 
OUString&, rCurItemId, vo
     {
         try
         {
-            OUString sNumber;
+            std::u16string_view sNumber;
             if (rCurItemId.startsWith("select", &sNumber))
             {
                 RequestOpenDeck();
-                SwitchToDeck(mpTabBar->GetDeckIdForIndex(sNumber.toInt32()));
+                
SwitchToDeck(mpTabBar->GetDeckIdForIndex(o3tl::toInt32(sNumber)));
             }
             mpParentWindow->GrabFocusToDocument();
         }
@@ -1176,10 +1177,10 @@ IMPL_LINK(SidebarController, OnSubMenuItemSelected, 
const OUString&, rCurItemId,
     {
         try
         {
-            OUString sNumber;
+            std::u16string_view sNumber;
             if (rCurItemId.startsWith("customize", &sNumber))
             {
-                mpTabBar->ToggleHideFlag(sNumber.toInt32());
+                mpTabBar->ToggleHideFlag(o3tl::toInt32(sNumber));
 
                 // Find the set of decks that could be displayed for the new 
context.
                 ResourceManager::DeckContextDescriptorContainer aDecks;
diff --git a/stoc/source/inspect/introspection.cxx 
b/stoc/source/inspect/introspection.cxx
index 5491001a070a..046063a0a2ae 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -28,6 +28,7 @@
 #include <set>
 
 #include <o3tl/any.hxx>
+#include <o3tl/string_view.hxx>
 #include <osl/diagnose.h>
 #include <sal/log.hxx>
 #include <cppuhelper/basemutex.hxx>
@@ -2014,7 +2015,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> 
Implementation::inspect(
 
                                 // Get name and evaluate
                                 OUString aMethName2 = rxMethod_k->getName();
-                                OUString aPropName2;
+                                std::u16string_view aPropName2;
                                 if (!(aMethName2.startsWith("set", &aPropName2)
                                       && aPropName2 == aPropName))
                                     continue;
@@ -2061,7 +2062,7 @@ css::uno::Reference<css::beans::XIntrospectionAccess> 
Implementation::inspect(
                         else if( aMethName.startsWith("add", &aPropName) )
                         {
                             // Does it end with "Listener"?
-                            OUString aListenerName;
+                            std::u16string_view aListenerName;
                             if( !aPropName.endsWith("Listener", 
&aListenerName) )
                                 continue;
 
@@ -2083,11 +2084,12 @@ css::uno::Reference<css::beans::XIntrospectionAccess> 
Implementation::inspect(
 
                                 // Get name and evaluate
                                 OUString aMethName2 = rxMethod_k->getName();
-                                OUString aListenerName2;
+                                std::u16string_view rest;
+                                std::u16string_view aListenerName2;
                                 if (!(aMethName2.startsWith(
-                                          "remove", &aPropName)
-                                      && aPropName.endsWith(
-                                          "Listener", &aListenerName2)
+                                          "remove", &rest)
+                                      && o3tl::ends_with(rest,
+                                          u"Listener", &aListenerName2)
                                       && aListenerName2 == aListenerName))
                                     continue;
 
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index a3543bd73d00..a66e64a472e9 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -1948,10 +1948,10 @@ namespace svxform
         for (int i = 0; i < nCount; ++i)
         {
             OUString sIdent = m_xTabCtrl->get_page_ident(i);
-            OUString sNumber;
+            std::u16string_view sNumber;
             if (!sIdent.startsWith("additional", &sNumber))
                 continue;
-            int nPageId = sNumber.toInt32();
+            int nPageId = o3tl::toInt32(sNumber);
             if (nMax < nPageId)
                 nMax = nPageId;
         }
diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx
index a87eaa52b7c5..8f78c0c2bc45 100644
--- a/svx/source/tbxctrls/Palette.cxx
+++ b/svx/source/tbxctrls/Palette.cxx
@@ -224,7 +224,7 @@ bool PaletteGPL::IsValid()
 bool PaletteGPL::ReadPaletteHeader(SvFileStream& rFileStream)
 {
     OString aLine;
-    OString aPaletteName;
+    std::string_view aPaletteName;
 
     rFileStream.ReadLine(aLine);
     if( !aLine.startsWith("GIMP Palette") ) return false;
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 857922dc833e..3beb26711f72 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -511,10 +511,10 @@ OUString DomainMapper_Impl::GetUnusedCharacterStyleName()
         sal_Int32         nMaxIndex       = 0;
         for ( const auto& rStyleName : aCharacterStyleNames )
         {
-            OUString sSuffix;
+            std::u16string_view sSuffix;
             if ( rStyleName.startsWith( cListLabel, &sSuffix ) )
             {
-                sal_Int32 nSuffix = sSuffix.toInt32();
+                sal_Int32 nSuffix = o3tl::toInt32(sSuffix);
                 if( nSuffix > 0 && nSuffix > nMaxIndex )
                     nMaxIndex = nSuffix;
             }
diff --git a/ucb/source/ucp/cmis/cmis_url.cxx b/ucb/source/ucp/cmis/cmis_url.cxx
index 43f5ce004e56..82eae06406ab 100644
--- a/ucb/source/ucp/cmis/cmis_url.cxx
+++ b/ucb/source/ucp/cmis/cmis_url.cxx
@@ -20,14 +20,14 @@ namespace cmis
 
     static OUString CheckInsecureProtocol(OUString const& rURL)
     {
-        OUString rest;
+        std::u16string_view rest;
         if (rURL.startsWithIgnoreAsciiCase("http://";, &rest))
         {
             if 
(!officecfg::Office::Security::Net::AllowInsecureProtocols::get())
             {
                 // "http" not allowed -> immediately redirect to "https",
                 // better than showing confusing error to user
-                return "https://"; + rest;
+                return OUString::Concat("https://";) + rest;
             }
         }
         return rURL;
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx 
b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 65f5f684b9fb..65fc7e6481d7 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -510,19 +510,19 @@ static auto ProcessHeaders(::std::vector<OString> const& 
rHeaders) -> ::std::map
     ::std::map<OUString, OUString> ret;
     for (OString const& rLine : rHeaders)
     {
-        OString line;
+        std::string_view line;
         if (!rLine.endsWith("
", &line))
         {
             SAL_WARN("ucb.ucp.webdav.curl", "invalid header field (no CRLF)");
             continue;
         }
-        if (line.startsWith("HTTP/") // first line
-            || line.isEmpty()) // last line
+        if (o3tl::starts_with(line, "HTTP/") // first line
+            || line.empty()) // last line
         {
             continue;
         }
-        auto const nColon(line.indexOf(':'));
-        if (nColon == -1)
+        auto const nColon(line.find(':'));
+        if (nColon == std::string_view::npos)
         {
             {
                 SAL_WARN("ucb.ucp.webdav.curl", "invalid header field (no :)");
@@ -535,20 +535,21 @@ static auto ProcessHeaders(::std::vector<OString> const& 
rHeaders) -> ::std::map
             continue;
         }
         // case insensitive; must be ASCII
-        auto const name(::rtl::OStringToOUString(line.copy(0, 
nColon).toAsciiLowerCase(),
+        auto const name(::rtl::OStringToOUString(OString(line.substr(0, 
nColon)).toAsciiLowerCase(),
                                                  RTL_TEXTENCODING_ASCII_US));
         sal_Int32 nStart(nColon + 1);
-        while (nStart < line.getLength() && (line[nStart] == ' ' || 
line[nStart] == '  '))
+        while (nStart < static_cast<sal_Int32>(line.size())
+               && (line[nStart] == ' ' || line[nStart] == '    '))
         {
             ++nStart;
         }
-        sal_Int32 nEnd(line.getLength());
+        sal_Int32 nEnd(line.size());
         while (nStart < nEnd && (line[nEnd - 1] == ' ' || line[nEnd - 1] == '  
'))
         {
             --nEnd;
         }
         // RFC 7230 says that only ASCII works reliably anyway (neon also did 
this)
-        auto const value(::rtl::OStringToOUString(line.subView(nStart, nEnd - 
nStart),
+        auto const value(::rtl::OStringToOUString(line.substr(nStart, nEnd - 
nStart),
                                                   RTL_TEXTENCODING_ASCII_US));
         auto const it(ret.find(name));
         if (it != ret.end())
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 53ed200ce870..783bdd3de5da 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -2282,10 +2282,10 @@ void TextView::ToggleComment()
         // Notice that a REM comment is only actually a comment if:
         // a) There is no subsequent character or
         // b) The subsequent character is a blank space or a tab
-        OUString sRest;
+        std::u16string_view sRest;
         if (sText.startsWithIgnoreAsciiCase("REM", &sRest))
         {
-            if (sRest.getLength() > 0 && !sRest.startsWith(" ") && 
!sRest.startsWith(" "))
+            if (sRest.size() > 0 && !o3tl::starts_with(sRest, u" ") && 
!o3tl::starts_with(sRest, u"    "))
             {
                 bAddCommentChar = true;
                 break;
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx 
b/vcl/source/filter/ipdf/pdfdocument.cxx
index dac68d5344af..71a604307db6 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -112,11 +112,11 @@ sal_uInt32 PDFDocument::GetNextSignature()
             continue;
 
         const OString& rValue = pT->GetValue();
-        static constexpr std::string_view aPrefix = "Signature";
-        if (!rValue.startsWith(aPrefix))
+        std::string_view rest;
+        if (!rValue.startsWith("Signature", &rest))
             continue;
 
-        nRet = std::max(nRet, o3tl::toUInt32(rValue.subView(aPrefix.size())));
+        nRet = std::max(nRet, o3tl::toUInt32(rest));
     }
 
     return nRet + 1;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index b35b4a581f04..797deace748a 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3911,15 +3911,15 @@ std::vector<vcl::EnumContext::Context> 
VclBuilder::handleStyle(xmlreader::XmlRea
             if (name == "class")
             {
                 OUString classStyle = getStyleClass(reader);
-                OUString rest;
+                std::u16string_view rest;
 
                 if (classStyle.startsWith("context-", &rest))
                 {
-                    aContext.push_back(vcl::EnumContext::GetContextEnum(rest));
+                    
aContext.push_back(vcl::EnumContext::GetContextEnum(OUString(rest)));
                 }
                 else if (classStyle.startsWith("priority-", &rest))
                 {
-                    nPriority = rest.toInt32();
+                    nPriority = o3tl::toInt32(rest);
                 }
                 else if (classStyle != "small-button" && classStyle != 
"destructive-action" && classStyle != "suggested-action")
                 {
diff --git a/vcl/unx/generic/printer/ppdparser.cxx 
b/vcl/unx/generic/printer/ppdparser.cxx
index e8e974c60579..6f354ad30ec1 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1002,11 +1002,11 @@ void PPDParser::parse( ::std::vector< OString >& rLines 
)
         }
         else if( aKey == "CustomPageSize" ) // currently not handled
             continue;
-        else if (aKey.startsWith("Custom", &aKey) )
+        else if ( std::string_view rest; aKey.startsWith("Custom", &rest) )
         {
             //fdo#43049 very basic support for Custom entries, we ignore the
             //validation params and types
-            OUString aUniKey(OStringToOUString(aKey, 
RTL_TEXTENCODING_MS_1252));
+            OUString aUniKey(OStringToOUString(rest, 
RTL_TEXTENCODING_MS_1252));
             keyit = m_aKeys.find( aUniKey );
             if(keyit != m_aKeys.end())
             {
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx 
b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 83083e7d0e16..86d521f11d89 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -289,7 +289,7 @@ const std::vector< OUString >& Databases::getModuleList( 
const OUString& Languag
             fileName = aStatus.getFileName();
 
             // Check, whether fileName is of the form *.cfg
-            if (!fileName.endsWithIgnoreAsciiCase(".cfg", &fileName)) {
+            if (!fileName.endsWithIgnoreAsciiCase(u".cfg", &fileName)) {
                 continue;
             }
             fileName = fileName.toAsciiLowerCase();
diff --git a/xmloff/source/draw/animationexport.cxx 
b/xmloff/source/draw/animationexport.cxx
index 9be7a7211ec7..64fee6b8ef4c 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -514,8 +514,7 @@ char const s_PkgScheme[] = "vnd.sun.star.Package:";
 
 static OUString lcl_StoreMediaAndGetURL(SvXMLExport & rExport, OUString const& 
rURL)
 {
-    OUString urlPath;
-    if (rURL.startsWithIgnoreAsciiCase(s_PkgScheme, &urlPath))
+    if (rURL.startsWithIgnoreAsciiCase(s_PkgScheme))
     {
         try // video is embedded
         {
@@ -528,7 +527,7 @@ static OUString lcl_StoreMediaAndGetURL(SvXMLExport & 
rExport, OUString const& r
             uno::Reference<embed::XStorage> const xTarget(
                     rExport.GetTargetStorage(), uno::UNO_SET_THROW);
 
-            urlPath = rURL.copy(SAL_N_ELEMENTS(s_PkgScheme)-1);
+            OUString urlPath = rURL.copy(SAL_N_ELEMENTS(s_PkgScheme)-1);
 
             lcl_CopyStream(xSource, xTarget, urlPath);
 

Reply via email to