basic/source/runtime/dllmgr-x64.cxx                            |    2 -
 basic/source/runtime/dllmgr-x86.cxx                            |    2 -
 chart2/source/tools/InternalDataProvider.cxx                   |   15 ++++----
 chart2/source/tools/PropertyHelper.cxx                         |    3 +
 chart2/source/tools/XMLRangeHelper.cxx                         |    3 +
 connectivity/source/drivers/dbase/DTable.cxx                   |    6 +--
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |    4 +-
 connectivity/source/drivers/odbc/ODatabaseMetaData.cxx         |    5 +-
 editeng/source/misc/svxacorr.cxx                               |    3 +
 filter/source/msfilter/util.cxx                                |    3 +
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx           |    3 +
 framework/source/fwe/helper/actiontriggerhelper.cxx            |    3 +
 oox/source/docprop/docprophandler.cxx                          |   17 
+++++-----
 oox/source/drawingml/customshapepresetdata.cxx                 |    5 +-
 oox/source/drawingml/customshapeproperties.cxx                 |    3 +
 oox/source/drawingml/hyperlinkcontext.cxx                      |    3 +
 oox/source/helper/attributelist.cxx                            |   13 ++++---
 oox/source/ole/axcontrol.cxx                                   |    5 +-
 oox/source/ppt/pptshape.cxx                                    |    5 +-
 oox/source/ppt/presentationfragmenthandler.cxx                 |    7 ++--
 oox/source/vml/vmldrawing.cxx                                  |    3 +
 oox/source/vml/vmlformatting.cxx                               |    7 ++--
 oox/source/vml/vmlshape.cxx                                    |    7 ++--
 oox/source/vml/vmlshapecontext.cxx                             |    3 +
 sc/source/core/data/global2.cxx                                |    7 ++--
 sc/source/core/data/table4.cxx                                 |    4 +-
 sc/source/filter/oox/formulaparser.cxx                         |    5 +-
 sc/source/filter/oox/pagesettings.cxx                          |    5 +-
 sc/source/filter/oox/sheetdatacontext.cxx                      |    5 +-
 sc/source/ui/docshell/impex.cxx                                |   11 +++---
 sc/source/ui/miscdlgs/acredlin.cxx                             |    3 +
 sd/source/filter/xml/sdxmlwrp.cxx                              |    5 +-
 sd/source/ui/presenter/PresenterTextView.cxx                   |    5 +-
 sfx2/source/appl/appopen.cxx                                   |    3 +
 sfx2/source/appl/childwin.cxx                                  |    6 +--
 sfx2/source/bastyp/mieclip.cxx                                 |    9 ++---
 sfx2/source/doc/docfile.cxx                                    |    3 +
 sfx2/source/doc/sfxbasemodel.cxx                               |    3 +
 svl/source/numbers/zformat.cxx                                 |    2 -
 svx/source/xoutdev/xattr.cxx                                   |    3 +
 sw/source/core/doc/doclay.cxx                                  |   10 +++--
 sw/source/core/doc/docnum.cxx                                  |    2 -
 sw/source/core/doc/doctxm.cxx                                  |    3 +
 sw/source/core/docnode/ndsect.cxx                              |    3 +
 sw/source/core/fields/cellfml.cxx                              |    2 -
 sw/source/core/unocore/XMLRangeHelper.cxx                      |    4 +-
 sw/source/core/unocore/unotbl.cxx                              |    2 -
 sw/source/filter/html/htmlatr.cxx                              |   11 +++---
 sw/source/filter/html/wrthtml.hxx                              |    2 -
 sw/source/filter/ww8/wrtww8gr.cxx                              |    3 +
 sw/source/ui/vba/vbaparagraphformat.cxx                        |    3 +
 sw/source/uibase/app/docsh2.cxx                                |    3 +
 sw/source/uibase/fldui/fldmgr.cxx                              |    4 +-
 sw/source/uibase/misc/redlndlg.cxx                             |    3 +
 sw/source/uibase/uiview/view2.cxx                              |    5 +-
 ucbhelper/source/client/proxydecider.cxx                       |    5 +-
 unotools/source/config/dynamicmenuoptions.cxx                  |    8 ++--
 vbahelper/source/vbahelper/vbalineformat.cxx                   |    2 -
 vcl/inc/ppdparser.hxx                                          |    2 -
 vcl/source/control/field2.cxx                                  |    8 ++--
 vcl/source/pdf/PDFiumLibrary.cxx                               |   13 ++++---
 vcl/unx/generic/printer/jobdata.cxx                            |   11 +++---
 vcl/unx/generic/printer/ppdparser.cxx                          |   17 
++++------
 writerfilter/source/dmapper/ConversionHelper.cxx               |    5 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx              |    7 ++--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx                 |    6 +--
 xmloff/source/chart/SchXMLChartContext.cxx                     |    5 +-
 xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx    |    3 +
 xmloff/source/core/xmlimp.cxx                                  |    7 ++--
 xmloff/source/xforms/SchemaRestrictionContext.cxx              |    7 ++--
 70 files changed, 214 insertions(+), 161 deletions(-)

New commits:
commit 36e0e88b28e818faf25b8e32cc8c4dc444b8a0be
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Apr 7 20:54:55 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Apr 8 13:18:41 2022 +0200

    use more subView when converting to Int32
    
    Change-Id: I54e3ddf79ba793fd4328bf8bda7f949b65349651
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132693
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basic/source/runtime/dllmgr-x64.cxx 
b/basic/source/runtime/dllmgr-x64.cxx
index b2ddbb890da1..15226cc3fb3c 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -608,7 +608,7 @@ ErrCode getProcData(HMODULE handle, OUString const & name, 
ProcData * proc)
 {
     assert(proc != nullptr);
     if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"???
-        sal_Int32 n = name.copy(1).toInt32(); //TODO: handle bad input
+        sal_Int32 n = comphelper::string::toInt32(name.subView(1)); //TODO: 
handle bad input
         if (n <= 0 || n > 0xFFFF) {
             return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode?
         }
diff --git a/basic/source/runtime/dllmgr-x86.cxx 
b/basic/source/runtime/dllmgr-x86.cxx
index 93e5c2bf533f..3433282c22ec 100644
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -584,7 +584,7 @@ ErrCode getProcData(HMODULE handle, OUString const & name, 
ProcData * proc)
 {
     assert(proc != 0);
     if ( !name.isEmpty() && name[0] == '@' ) { //TODO: "@" vs. "#"???
-        sal_Int32 n = name.copy(1).toInt32(); //TODO: handle bad input
+        sal_Int32 n = comphelper::string::toInt32(name.subView(1)); //TODO: 
handle bad input
         if (n <= 0 || n > 0xFFFF) {
             return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode?
         }
diff --git a/chart2/source/tools/InternalDataProvider.cxx 
b/chart2/source/tools/InternalDataProvider.cxx
index 6fe4ec94a8db..ecee58fdbb88 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -40,6 +40,7 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 #include <comphelper/property.hxx>
+#include <comphelper/string.hxx>
 #include <tools/diagnose_ex.h>
 
 #include <limits>
@@ -825,7 +826,7 @@ Reference< chart2::data::XDataSequence > SAL_CALL 
InternalDataProvider::createDa
     else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
     {
         // label
-        sal_Int32 nIndex = aRangeRepresentation.copy( 
strlen(lcl_aLabelRangePrefix)).toInt32();
+        sal_Int32 nIndex = 
comphelper::string::toInt32(aRangeRepresentation.subView( 
strlen(lcl_aLabelRangePrefix)));
         return createDataSequenceAndAddToMap( lcl_aLabelRangePrefix + 
OUString::number( nIndex ));
     }
     else if ( aRangeRepresentation == "last" )
@@ -869,7 +870,7 @@ sal_Bool SAL_CALL 
InternalDataProvider::hasDataByRangeRepresentation( const OUSt
     }
     else if( aRange.match( lcl_aLabelRangePrefix ))
     {
-        sal_Int32 nIndex = aRange.copy( 
strlen(lcl_aLabelRangePrefix)).toInt32();
+        sal_Int32 nIndex = comphelper::string::toInt32(aRange.subView( 
strlen(lcl_aLabelRangePrefix)));
         bResult = (nIndex < (m_bDataInColumns ? 
m_aInternalData.getColumnCount(): m_aInternalData.getRowCount()));
     }
     else
@@ -905,7 +906,7 @@ Sequence< uno::Any > SAL_CALL 
InternalDataProvider::getDataByRangeRepresentation
     }
     else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
     {
-        sal_Int32 nLevel = aRange.copy( 
strlen(lcl_aCategoriesLevelRangeNamePrefix) ).toInt32();
+        sal_Int32 nLevel = comphelper::string::toInt32(aRange.subView( 
strlen(lcl_aCategoriesLevelRangeNamePrefix) ));
         vector< vector< uno::Any > > aCategories( m_bDataInColumns ? 
m_aInternalData.getComplexRowLabels() : 
m_aInternalData.getComplexColumnLabels());
         if( nLevel < lcl_getInnerLevelCount( aCategories ) )
         {
@@ -957,7 +958,7 @@ void SAL_CALL 
InternalDataProvider::setDataByRangeRepresentation(
     auto aNewVector( comphelper::sequenceToContainer<vector< uno::Any 
>>(aNewData) );
     if( aRange.match( lcl_aLabelRangePrefix ) )
     {
-        sal_uInt32 nIndex = aRange.copy( 
strlen(lcl_aLabelRangePrefix)).toInt32();
+        sal_uInt32 nIndex = comphelper::string::toInt32(aRange.subView( 
strlen(lcl_aLabelRangePrefix)));
         if( m_bDataInColumns )
             m_aInternalData.setComplexColumnLabel( nIndex, 
std::move(aNewVector) );
         else
@@ -965,7 +966,7 @@ void SAL_CALL 
InternalDataProvider::setDataByRangeRepresentation(
     }
     else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
     {
-        sal_Int32 nPointIndex = aRange.copy( 
strlen(lcl_aCategoriesLevelRangeNamePrefix)).toInt32();
+        sal_Int32 nPointIndex = comphelper::string::toInt32(aRange.subView( 
strlen(lcl_aCategoriesLevelRangeNamePrefix)));
         if( m_bDataInColumns )
             m_aInternalData.setComplexRowLabel( nPointIndex, 
std::move(aNewVector) );
         else
@@ -973,7 +974,7 @@ void SAL_CALL 
InternalDataProvider::setDataByRangeRepresentation(
     }
     else if( aRange.match( lcl_aCategoriesLevelRangeNamePrefix ) )
     {
-        sal_Int32 nLevel = aRange.copy( 
strlen(lcl_aCategoriesLevelRangeNamePrefix)).toInt32();
+        sal_Int32 nLevel = comphelper::string::toInt32(aRange.subView( 
strlen(lcl_aCategoriesLevelRangeNamePrefix)));
         vector< vector< uno::Any > > aComplexCategories = m_bDataInColumns ? 
m_aInternalData.getComplexRowLabels() : 
m_aInternalData.getComplexColumnLabels();
 
         //ensure equal length
@@ -1190,7 +1191,7 @@ OUString SAL_CALL 
InternalDataProvider::convertRangeToXML( const OUString& aRang
     }
     else if( aRangeRepresentation.match( lcl_aLabelRangePrefix ))
     {
-        sal_Int32 nIndex = aRangeRepresentation.copy( 
strlen(lcl_aLabelRangePrefix)).toInt32();
+        sal_Int32 nIndex = 
comphelper::string::toInt32(aRangeRepresentation.subView( 
strlen(lcl_aLabelRangePrefix)));
         aRange.aUpperLeft.bIsEmpty = false;
         aRange.aLowerRight.bIsEmpty = true;
         if( m_bDataInColumns )
diff --git a/chart2/source/tools/PropertyHelper.cxx 
b/chart2/source/tools/PropertyHelper.cxx
index 9718cbfa676f..b50d3b58d3d2 100644
--- a/chart2/source/tools/PropertyHelper.cxx
+++ b/chart2/source/tools/PropertyHelper.cxx
@@ -21,6 +21,7 @@
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <comphelper/sequence.hxx>
+#include <comphelper/string.hxx>
 #include <osl/diagnose.h>
 #include <tools/diagnose_ex.h>
 #include <o3tl/string_view.hxx>
@@ -86,7 +87,7 @@ struct lcl_OUStringRestToInt32
     {
         if( m_nPrefixLength > rStr.getLength() )
             return 0;
-        return rStr.copy( m_nPrefixLength ).toInt32();
+        return comphelper::string::toInt32(rStr.subView( m_nPrefixLength ));
     }
 private:
     sal_Int32 m_nPrefixLength;
diff --git a/chart2/source/tools/XMLRangeHelper.cxx 
b/chart2/source/tools/XMLRangeHelper.cxx
index cc4749deee1f..c052e42ea3d6 100644
--- a/chart2/source/tools/XMLRangeHelper.cxx
+++ b/chart2/source/tools/XMLRangeHelper.cxx
@@ -21,6 +21,7 @@
 #include <rtl/character.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <osl/diagnose.h>
+#include <comphelper/string.hxx>
 
 #include <algorithm>
 
@@ -119,7 +120,7 @@ void lcl_getSingleCellAddressFromXMLString(
     // parse number for row
     while( rtl::isAsciiDigit( pStrArray[ i ] ) && i >= 0 )
         i--;
-    rOutCell.nRow = (aCellStr.copy( i + 1 )).toInt32() - 1;
+    rOutCell.nRow = (comphelper::string::toInt32(aCellStr.subView( i + 1 ))) - 
1;
     // a dollar in XML means absolute (whereas in UI it means relative)
     if( pStrArray[ i ] == aDollar )
     {
diff --git a/connectivity/source/drivers/dbase/DTable.cxx 
b/connectivity/source/drivers/dbase/DTable.cxx
index ad3aa66f2dd1..aacad7e6e08f 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -952,9 +952,9 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const 
OSQLColumns & _rCols, bool
                         (*_rRow)[i]->setNull();
                         break;
                     }
-                    const sal_uInt16  nYear   = 
static_cast<sal_uInt16>(aStr.copy( 0, 4 ).toInt32());
-                    const sal_uInt16  nMonth  = 
static_cast<sal_uInt16>(aStr.copy( 4, 2 ).toInt32());
-                    const sal_uInt16  nDay    = 
static_cast<sal_uInt16>(aStr.copy( 6, 2 ).toInt32());
+                    const sal_uInt16  nYear   = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aStr.subView( 0, 4 )));
+                    const sal_uInt16  nMonth  = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aStr.subView( 4, 2 )));
+                    const sal_uInt16  nDay    = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aStr.subView( 6, 2 )));
 
                     const css::util::Date aDate(nDay,nMonth,nYear);
                     *(*_rRow)[i] = aDate;
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
index 57856804c793..43348041b039 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx
@@ -22,6 +22,7 @@
 #include <com/sun/star/sdbc/Deferrability.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <comphelper/sequence.hxx>
+#include <comphelper/string.hxx>
 
 #include <sal/log.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -750,7 +751,8 @@ Reference<XResultSet> SAL_CALL 
ODatabaseMetaData::getColumns(const Any& /*catalo
         sal_Int32 nCharMaxLen = xRow->getShort(6);
         bool bIsCharMax = !xRow->wasNull();
         if (sDataType.equalsIgnoreAsciiCase("year"))
-            nColumnSize = sColumnType.copy(6, 1).toInt32(); // 'year(' length 
is 5
+            nColumnSize
+                = comphelper::string::toInt32(sColumnType.subView(6, 1)); // 
'year(' length is 5
         else if (sDataType.equalsIgnoreAsciiCase("date"))
             nColumnSize = 10;
         else if (sDataType.equalsIgnoreAsciiCase("time"))
diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx 
b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
index 957142027182..7959081df70c 100644
--- a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
+++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx
@@ -28,6 +28,7 @@
 #include <TPrivilegesResultSet.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
+#include <comphelper/string.hxx>
 
 using namespace connectivity::odbc;
 using namespace com::sun::star::uno;
@@ -1241,7 +1242,7 @@ sal_Int32 SAL_CALL 
ODatabaseMetaData::getDriverMajorVersion(  ) try
 {
     OUString aValue;
     
OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
-    return aValue.copy(0,aValue.indexOf('.')).toInt32();
+    return comphelper::string::toInt32(aValue.subView(0,aValue.indexOf('.')));
 }
 catch (const SQLException &)
 {
@@ -1277,7 +1278,7 @@ sal_Int32 SAL_CALL 
ODatabaseMetaData::getDriverMinorVersion(  ) try
 {
     OUString aValue;
     
OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_DRIVER_VER,aValue,*this,m_pConnection->getTextEncoding());
-    return aValue.copy(0,aValue.lastIndexOf('.')).toInt32();
+    return 
comphelper::string::toInt32(aValue.subView(0,aValue.lastIndexOf('.')));
 }
 catch (const SQLException &)
 {
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 6bb39831bf01..452e7ed2bd78 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -43,6 +43,7 @@
 #include <unotools/transliterationwrapper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
+#include <comphelper/string.hxx>
 #include <editeng/editids.hrc>
 #include <sot/storage.hxx>
 #include <editeng/udlnitem.hxx>
@@ -509,7 +510,7 @@ bool SvxAutoCorrect::FnChgOrdinalNumber(
         }
 
         if (bFoundEnd && isValidNumber) {
-            sal_Int32 nNum = rTxt.copy(nSttPos, nNumEnd - nSttPos + 
1).toInt32();
+            sal_Int32 nNum = comphelper::string::toInt32(rTxt.subView(nSttPos, 
nNumEnd - nSttPos + 1));
 
             // Check if the characters after that number correspond to the 
ordinal suffix
             uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 51e2d3de5a80..c85d1f58e540 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -15,6 +15,7 @@
 #include <vcl/BitmapPalette.hxx>
 #include <filter/msfilter/escherex.hxx>
 #include <filter/msfilter/util.hxx>
+#include <comphelper/string.hxx>
 #include <memory>
 #include <unordered_map>
 
@@ -488,7 +489,7 @@ bool WW8ReadFieldParams::GetTokenSttFromTo(sal_Int32* 
pFrom, sal_Int32* pTo, sal
         if (nIndex>=0)
         {
             nStart = sStart.toInt32();
-            nEnd   = sParams.copy(nIndex).toInt32();
+            nEnd   = comphelper::string::toInt32(sParams.subView(nIndex));
         }
     }
     if( pFrom ) *pFrom = nStart;
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx 
b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 81dcba978f8a..dac4259f4bed 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
 
 #include <comphelper/propertyvalue.hxx>
+#include <comphelper/string.hxx>
 #include <tools/diagnose_ex.h>
 #include <tools/urlobj.hxx>
 #include <unotools/pathoptions.hxx>
@@ -368,7 +369,7 @@ OUString 
XMLFilterSettingsDialog::createUniqueInterfaceName( const OUString& rIn
                     {
                         // if yes, make sure we generate a unique name with a 
higher number
                         // this is dump but fast
-                        sal_Int32 nNumber = aInterfaceName.copy( 
rInterfaceName.getLength() ).toInt32();
+                        sal_Int32 nNumber = 
comphelper::string::toInt32(aInterfaceName.subView( rInterfaceName.getLength() 
));
                         if( nNumber >= nDefaultNumber )
                             nDefaultNumber = nNumber + 1;
                     }
diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx 
b/framework/source/fwe/helper/actiontriggerhelper.cxx
index 82f5d558f3be..5f0e1c388cea 100644
--- a/framework/source/fwe/helper/actiontriggerhelper.cxx
+++ b/framework/source/fwe/helper/actiontriggerhelper.cxx
@@ -31,6 +31,7 @@
 #include <vcl/dibtools.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/svapp.hxx>
+#include <comphelper/string.hxx>
 
 const sal_uInt16 START_ITEMID = 1000;
 
@@ -139,7 +140,7 @@ static void InsertSubMenuItems(const Reference<XPopupMenu>& 
rSubMenu, sal_uInt16
                             // command url but uses the item id as a unique 
identifier. These entries
                             // got a special url during conversion from 
menu=>actiontriggercontainer.
                             // Now we have to extract this special url and set 
the correct item id!!!
-                            nNewItemId = 
static_cast<sal_uInt16>(aCommandURL.copy( nIndex+aSlotURL.getLength() 
).toInt32());
+                            nNewItemId = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aCommandURL.subView( 
nIndex+aSlotURL.getLength() )));
                             rSubMenu->insertItem(nNewItemId, aLabel, 0, i);
                         }
                         else
diff --git a/oox/source/docprop/docprophandler.cxx 
b/oox/source/docprop/docprophandler.cxx
index 95043e497aea..587740f24a93 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 #include <com/sun/star/xml/sax/SAXException.hpp>
 #include <cppuhelper/exc_hlp.hxx>
+#include <comphelper/string.hxx>
 
 #include <o3tl/safeint.hxx>
 #include <osl/time.h>
@@ -98,25 +99,25 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( 
const OUString& aChar
     const sal_Int32 nLen = aChars.getLength();
     if ( nLen >= 4 )
     {
-        aOslDTime.Year = static_cast<sal_Int16>(aChars.copy( 0, 4 ).toInt32());
+        aOslDTime.Year = 
static_cast<sal_Int16>(comphelper::string::toInt32(aChars.subView( 0, 4 )));
 
         if ( nLen >= 7 && aChars[4] == '-' )
         {
-            aOslDTime.Month = static_cast<sal_uInt16>(aChars.copy( 5, 2 
).toInt32());
+            aOslDTime.Month = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 5, 2 )));
 
             if ( nLen >= 10 && aChars[7] == '-' )
             {
-                aOslDTime.Day = static_cast<sal_uInt16>(aChars.copy( 8, 2 
).toInt32());
+                aOslDTime.Day = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 8, 2 )));
 
                 if ( nLen >= 16 && aChars[10] == 'T' && aChars[13] == ':' )
                 {
-                    aOslDTime.Hours = static_cast<sal_uInt16>(aChars.copy( 11, 
2 ).toInt32());
-                    aOslDTime.Minutes = static_cast<sal_uInt16>(aChars.copy( 
14, 2 ).toInt32());
+                    aOslDTime.Hours = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 11, 2 )));
+                    aOslDTime.Minutes = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 14, 2 )));
 
                     sal_Int32 nOptTime = 0;
                     if ( nLen >= 19 && aChars[16] == ':' )
                     {
-                        aOslDTime.Seconds = 
static_cast<sal_uInt16>(aChars.copy( 17, 2 ).toInt32());
+                        aOslDTime.Seconds = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 17, 2 )));
                         nOptTime += 3;
                         if ( nLen >= 20 && aChars[19] == '.' )
                         {
@@ -162,8 +163,8 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( 
const OUString& aChar
                         if ( ( aChars[16 + nOptTime] == '+' || aChars[16 + 
nOptTime] == '-' )
                           && aChars[16 + nOptTime + 3] == ':' )
                         {
-                            nModif = aChars.copy( 16 + nOptTime + 1, 2 
).toInt32() * 3600;
-                            nModif += aChars.copy( 16 + nOptTime + 4, 2 
).toInt32() * 60;
+                            nModif = 
comphelper::string::toInt32(aChars.subView( 16 + nOptTime + 1, 2 )) * 3600;
+                            nModif += 
comphelper::string::toInt32(aChars.subView( 16 + nOptTime + 4, 2 )) * 60;
                             if ( aChars[16 + nOptTime] == '-' )
                                 nModif *= -1;
                         }
diff --git a/oox/source/drawingml/customshapepresetdata.cxx 
b/oox/source/drawingml/customshapepresetdata.cxx
index ea1fcbb41362..75f43c94e80a 100644
--- a/oox/source/drawingml/customshapepresetdata.cxx
+++ b/oox/source/drawingml/customshapepresetdata.cxx
@@ -20,6 +20,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <comphelper/string.hxx>
 
 using namespace ::com::sun::star;
 
@@ -151,7 +152,7 @@ awt::Rectangle lcl_parseRectangle(const OString& rValue)
     static const char aExpectedHeightPrefix[] = " Height = (long) ";
     assert(nIndex >= 0 && rValue.match(aExpectedHeightPrefix, nIndex));
     nIndex += strlen(aExpectedHeightPrefix);
-    aRectangle.Height = rValue.copy(nIndex).toInt32();
+    aRectangle.Height = comphelper::string::toInt32(rValue.subView(nIndex));
 
     return aRectangle;
 }
@@ -168,7 +169,7 @@ awt::Size lcl_parseSize(const OString& rValue)
     static const char aExpectedHeightPrefix[] = " Height = (long) ";
     assert(nIndex >= 0 && rValue.match(aExpectedHeightPrefix, nIndex));
     nIndex += strlen(aExpectedHeightPrefix);
-    aSize.Height = rValue.copy(nIndex).toInt32();
+    aSize.Height = comphelper::string::toInt32(rValue.subView(nIndex));
 
     return aSize;
 }
diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index b748deb48702..3e81b84a133f 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
 #include <comphelper/sequence.hxx>
+#include <comphelper/string.hxx>
 #include <sal/log.hxx>
 
 #include <algorithm>
@@ -150,7 +151,7 @@ void CustomShapeProperties::pushToPropSet(
                             {
                                 if ( adjustmentGuide.maName.getLength() > 3 )
                                 {
-                                    sal_Int32 nAdjustmentIndex = 
adjustmentGuide.maName.copy( 3 ).toInt32() - 1;
+                                    sal_Int32 nAdjustmentIndex = 
comphelper::string::toInt32(adjustmentGuide.maName.subView( 3 )) - 1;
                                     if ( ( nAdjustmentIndex >= 0 ) && ( 
nAdjustmentIndex < aAdjustmentSeq.getLength() ) )
                                     {
                                         EnhancedCustomShapeAdjustmentValue 
aAdjustmentVal;
diff --git a/oox/source/drawingml/hyperlinkcontext.cxx 
b/oox/source/drawingml/hyperlinkcontext.cxx
index 0221e3875d31..844cb7a4fb2c 100644
--- a/oox/source/drawingml/hyperlinkcontext.cxx
+++ b/oox/source/drawingml/hyperlinkcontext.cxx
@@ -28,6 +28,7 @@
 #include <oox/token/namespaces.hxx>
 #include <oox/token/properties.hxx>
 #include <oox/token/tokens.hxx>
+#include <comphelper/string.hxx>
 
 using namespace ::oox::core;
 using namespace ::com::sun::star::uno;
@@ -116,7 +117,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper 
const & rParent,
                             break;
                         nLength++;
                     }
-                    sal_Int32 nPageNumber = sHref.copy( nIndex2, nLength 
).toInt32();
+                    sal_Int32 nPageNumber = 
comphelper::string::toInt32(sHref.subView( nIndex2, nLength ));
                     if ( nPageNumber )
                     {
                         const OUString aSlideType( sHref.copy( 0, nIndex2 ) );
diff --git a/oox/source/helper/attributelist.cxx 
b/oox/source/helper/attributelist.cxx
index 6ac3ea872eb4..a8f19a335cbc 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -23,6 +23,7 @@
 #include <rtl/ustrbuf.hxx>
 #include <sax/fastattribs.hxx>
 #include <oox/token/tokenmap.hxx>
+#include <comphelper/string.hxx>
 
 namespace oox {
 
@@ -253,12 +254,12 @@ OptValue< util::DateTime > AttributeList::getDateTime( 
sal_Int32 nAttrToken ) co
         (aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == 
':');
     if( bValid )
     {
-        aDateTime.Year    = static_cast< sal_uInt16 >( aValue.copy( 0, 4 
).toInt32() );
-        aDateTime.Month   = static_cast< sal_uInt16 >( aValue.copy( 5, 2 
).toInt32() );
-        aDateTime.Day     = static_cast< sal_uInt16 >( aValue.copy( 8, 2 
).toInt32() );
-        aDateTime.Hours   = static_cast< sal_uInt16 >( aValue.copy( 11, 2 
).toInt32() );
-        aDateTime.Minutes = static_cast< sal_uInt16 >( aValue.copy( 14, 2 
).toInt32() );
-        aDateTime.Seconds = static_cast< sal_uInt16 >( aValue.copy( 17, 2 
).toInt32() );
+        aDateTime.Year    = static_cast< sal_uInt16 >( 
comphelper::string::toInt32(aValue.subView( 0, 4 )) );
+        aDateTime.Month   = static_cast< sal_uInt16 >( 
comphelper::string::toInt32(aValue.subView( 5, 2 )) );
+        aDateTime.Day     = static_cast< sal_uInt16 >( 
comphelper::string::toInt32(aValue.subView( 8, 2 )) );
+        aDateTime.Hours   = static_cast< sal_uInt16 >( 
comphelper::string::toInt32(aValue.subView( 11, 2 )) );
+        aDateTime.Minutes = static_cast< sal_uInt16 >( 
comphelper::string::toInt32(aValue.subView( 14, 2 )) );
+        aDateTime.Seconds = static_cast< sal_uInt16 >( 
comphelper::string::toInt32(aValue.subView( 17, 2 )) );
     }
     return OptValue< util::DateTime >( bValid, aDateTime );
 }
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 7442e54ea675..f960e819417f 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -63,6 +63,7 @@
 #include <oox/token/properties.hxx>
 #include <oox/token/tokens.hxx>
 #include <tools/diagnose_ex.h>
+#include <comphelper/string.hxx>
 
 namespace oox::ole {
 
@@ -837,8 +838,8 @@ void AxControlModelBase::importProperty( sal_Int32 nPropId, 
const OUString& rVal
             OSL_ENSURE( nSepPos >= 0, "AxControlModelBase::importProperty - 
missing separator in 'Size' property" );
             if( nSepPos >= 0 )
             {
-                maSize.first = rValue.copy( 0, nSepPos ).toInt32();
-                maSize.second = rValue.copy( nSepPos + 1 ).toInt32();
+                maSize.first = comphelper::string::toInt32(rValue.subView( 0, 
nSepPos ));
+                maSize.second = comphelper::string::toInt32(rValue.subView( 
nSepPos + 1 ));
             }
         }
         break;
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 92b61176d0c1..f334d100a05d 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -42,6 +42,7 @@
 #include <oox/ppt/slidepersist.hxx>
 #include <oox/token/tokens.hxx>
 #include <oox/token/properties.hxx>
+#include <comphelper/string.hxx>
 
 using namespace ::oox::core;
 using namespace ::oox::drawingml;
@@ -473,7 +474,7 @@ void PPTShape::addShape(
                             if (xNamed->getName().startsWith(aTitleText, 
&sRest)
                                 && (sRest.isEmpty()
                                     || (sRest.startsWith(" (") && 
sRest.endsWith(")")
-                                        && sRest.copy(2, sRest.getLength() - 
3).toInt32() > 0)))
+                                        && 
comphelper::string::toInt32(sRest.subView(2, sRest.getLength() - 3)) > 0)))
                                 nCount++;
                         }
                         Reference<container::XNamed> 
xName(rSlidePersist.getPage(), UNO_QUERY_THROW);
@@ -620,7 +621,7 @@ void PPTShape::addShape(
                             sal_Int32 nPageNumber = 0;
                             static const OUStringLiteral sSlide = u"Slide ";
                             if (sURL.match(sSlide))
-                                nPageNumber = 
sURL.copy(sSlide.getLength()).toInt32();
+                                nPageNumber = 
comphelper::string::toInt32(sURL.subView(sSlide.getLength()));
                             Reference<drawing::XDrawPagesSupplier> 
xDPS(rFilterBase.getModel(),
                                                                         
uno::UNO_QUERY_THROW);
                             Reference<drawing::XDrawPages> 
xDrawPages(xDPS->getDrawPages(),
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index a088bf04636e..2d5f18af81d5 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -20,6 +20,7 @@
 #include <comphelper/anytostring.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/string.hxx>
 #include <sal/log.hxx>
 #include <tools/multisel.hxx>
 #include <tools/diagnose_ex.h>
@@ -131,10 +132,10 @@ static void ResolveTextFields( XmlFilterBase const & 
rFilter )
                 bool bNotes = false;
                 sal_Int32 nPageNumber = 0;
                 if ( aURL.match( sSlide ) )
-                    nPageNumber = aURL.copy( sSlide.getLength() ).toInt32();
+                    nPageNumber = comphelper::string::toInt32(aURL.subView( 
sSlide.getLength() ));
                 else if ( aURL.match( sNotes ) )
                 {
-                    nPageNumber = aURL.copy( sNotes.getLength() ).toInt32();
+                    nPageNumber = comphelper::string::toInt32(aURL.subView( 
sNotes.getLength() ));
                     bNotes = true;
                 }
                 if ( nPageNumber )
@@ -192,7 +193,7 @@ void 
PresentationFragmentHandler::importCustomSlideShow(std::vector<CustomShow>&
                 OUString sCustomSlide = rCustomShowList[i].maSldLst[j];
                 sal_Int32 nPageNumber = 0;
                 if (sCustomSlide.match(sSlide))
-                    nPageNumber = 
sCustomSlide.copy(sSlide.getLength()).toInt32();
+                    nPageNumber = 
comphelper::string::toInt32(sCustomSlide.subView(sSlide.getLength()));
 
                 Reference<XDrawPage> xPage;
                 xDrawPages->getByIndex(nPageNumber - 1) >>= xPage;
diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx
index 1d468fe7b3cd..aa64ce397caa 100644
--- a/oox/source/vml/vmldrawing.cxx
+++ b/oox/source/vml/vmldrawing.cxx
@@ -38,6 +38,7 @@
 #include <oox/vml/vmlshapecontainer.hxx>
 #include <tools/diagnose_ex.h>
 #include <tools/gen.hxx>
+#include <comphelper/string.hxx>
 
 namespace oox::vml {
 
@@ -65,7 +66,7 @@ OUString lclGetShapeId( sal_Int32 nShapeId )
 sal_Int32 lclGetShapeId( const OUString& rShapeId )
 {
     // identifier consists of a literal NUL character, a lowercase 's', and 
the id
-    return ((rShapeId.getLength() >= 3) && (rShapeId[ 0 ] == '\0') && 
(rShapeId[ 1 ] == 's')) ? rShapeId.copy( 2 ).toInt32() : -1;
+    return ((rShapeId.getLength() >= 3) && (rShapeId[ 0 ] == '\0') && 
(rShapeId[ 1 ] == 's')) ? comphelper::string::toInt32(rShapeId.subView( 2 )) : 
-1;
 }
 
 } // namespace
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 5474f782aa64..a93996d94289 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -45,6 +45,7 @@
 #include <oox/token/tokens.hxx>
 #include <svx/svdtrans.hxx>
 #include <comphelper/propertysequence.hxx>
+#include <comphelper/string.hxx>
 #include <vcl/virdev.hxx>
 
 namespace oox::vml {
@@ -274,7 +275,7 @@ Color ConversionHelper::decodeColor( const GraphicHelper& 
rGraphicHelper,
     // try palette colors enclosed in brackets
     if( (aColorIndex.getLength() >= 3) && (aColorIndex[ 0 ] == '[') && 
(aColorIndex[ aColorIndex.getLength() - 1 ] == ']') )
     {
-        aDmlColor.setPaletteClr( aColorIndex.copy( 1, aColorIndex.getLength() 
- 2 ).toInt32() );
+        aDmlColor.setPaletteClr( 
comphelper::string::toInt32(aColorIndex.subView( 1, aColorIndex.getLength() - 2 
)) );
         return aDmlColor;
     }
 
@@ -291,7 +292,7 @@ Color ConversionHelper::decodeColor( const GraphicHelper& 
rGraphicHelper,
                 case XML_darken:    nModToken = XML_shade;break;
                 case XML_lighten:   nModToken = XML_tint;
             }
-            sal_Int32 nValue = aColorIndex.copy( nOpenParen + 1, nCloseParen - 
nOpenParen - 1 ).toInt32();
+            sal_Int32 nValue = 
comphelper::string::toInt32(aColorIndex.subView( nOpenParen + 1, nCloseParen - 
nOpenParen - 1 ));
             if( (nModToken != XML_TOKEN_INVALID) && (0 <= nValue) && (nValue < 
255) )
             {
                 /*  Simulate this modifier color by a color with related 
transformation.
@@ -336,7 +337,7 @@ void ConversionHelper::decodeVmlPath( ::std::vector< 
::std::vector< Point > >& r
             if ( state != START && state != UNSUPPORTED )
             {
                 if ( nTokenLen > 0 )
-                    aCoordList.push_back( rPath.copy( nTokenStart, nTokenLen 
).toInt32() );
+                    aCoordList.push_back( 
comphelper::string::toInt32(rPath.subView( nTokenStart, nTokenLen )) );
                 else
                     aCoordList.push_back( 0 );
                 nTokenLen = 0;
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index f87cb12a6899..a0768503560b 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -69,6 +69,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <comphelper/storagehelper.hxx>
+#include <comphelper/string.hxx>
 
 using ::com::sun::star::beans::XPropertySet;
 using ::com::sun::star::uno::Any;
@@ -313,7 +314,7 @@ void ShapeBase::finalizeFragmentImport()
         static const OUStringLiteral sShapeTypePrefix = u"shapetype_";
         OUString tmp;
         if (aType.startsWith(sShapeTypePrefix)) {
-            maTypeModel.moShapeType = 
aType.copy(sShapeTypePrefix.getLength()).toInt32();
+            maTypeModel.moShapeType = 
comphelper::string::toInt32(aType.subView(sShapeTypePrefix.getLength()));
         }
         else if (aType.startsWith("_x0000_t", &tmp)) {
             maTypeModel.moShapeType = tmp.toInt32();
@@ -377,8 +378,8 @@ Reference< XShape > ShapeBase::convertAndInsert( const 
Reference< XShapes >& rxS
                     if (idPos < seqPos)
                     {
                         auto idPosEnd = idPos+2;
-                        id = sLinkChainName.copy(idPosEnd, seqPos - 
idPosEnd).toInt32();
-                        seq = sLinkChainName.copy(seqPos+2).toInt32();
+                        id = 
comphelper::string::toInt32(sLinkChainName.subView(idPosEnd, seqPos - 
idPosEnd));
+                        seq = 
comphelper::string::toInt32(sLinkChainName.subView(seqPos+2));
                     }
                 }
 
diff --git a/oox/source/vml/vmlshapecontext.cxx 
b/oox/source/vml/vmlshapecontext.cxx
index 4ed3f83fd076..d41539083917 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -35,6 +35,7 @@
 
 #include <osl/diagnose.h>
 #include <filter/msfilter/escherex.hxx>
+#include <comphelper/string.hxx>
 
 namespace oox::vml {
 
@@ -299,7 +300,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper 
const & rParent,
         if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) )
         {
             mrTypeModel.maShapeId = mrTypeModel.maShapeName;
-            mrTypeModel.moShapeType = 
mrTypeModel.maShapeName.copy(sShapeTypePrefix.getLength()).toInt32();
+            mrTypeModel.moShapeType = 
comphelper::string::toInt32(mrTypeModel.maShapeName.subView(sShapeTypePrefix.getLength()));
         }
         else if (mrTypeModel.maShapeName.startsWith("_x0000_t", &tmp))
         {
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index 5d58a3e8c2e3..6d67c59a863a 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -28,6 +28,7 @@
 #include <sal/log.hxx>
 #include <rtl/character.hxx>
 #include <rtl/math.hxx>
+#include <comphelper/string.hxx>
 
 #include <global.hxx>
 #include <rangeutl.hxx>
@@ -448,7 +449,7 @@ Label_fallback_to_unambiguous:
                     const sal_Int32 nLimit[done] = {0,12,31,0,59,59,0};
                     State eState = (bDate ? month : minute);
                     rCurFmtType = (bDate ? SvNumFormatType::DATE : 
SvNumFormatType::TIME);
-                    nUnit[eState-1] = rStr.copy( 0, nParseEnd).toInt32();
+                    nUnit[eState-1] = 
comphelper::string::toInt32(rStr.subView( 0, nParseEnd));
                     const sal_Unicode* pLastStart = p;
                     // Ensure there's no preceding sign. Negative dates
                     // currently aren't handled correctly. Also discard
@@ -474,7 +475,7 @@ Label_fallback_to_unambiguous:
                             // We had at least one digit.
                             if (eState < done)
                             {
-                                nUnit[eState] = rStr.copy( pLastStart - 
pStart, p - pLastStart).toInt32();
+                                nUnit[eState] = 
comphelper::string::toInt32(rStr.subView( pLastStart - pStart, p - pLastStart));
                                 if (nLimit[eState] && nLimit[eState] < 
nUnit[eState])
                                     rError = nStringNoValueError;
                             }
@@ -545,7 +546,7 @@ Label_fallback_to_unambiguous:
                         // Catch the very last unit at end of string.
                         if (p > pLastStart && eState < done)
                         {
-                            nUnit[eState] = rStr.copy( pLastStart - pStart, p 
- pLastStart).toInt32();
+                            nUnit[eState] = 
comphelper::string::toInt32(rStr.subView( pLastStart - pStart, p - pLastStart));
                             if (nLimit[eState] && nLimit[eState] < 
nUnit[eState])
                                 rError = nStringNoValueError;
                         }
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 9f2b26cff25e..c0443dcf155a 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -80,7 +80,7 @@ short lcl_DecompValueString( OUString& rValue, sal_Int32& 
nVal, sal_uInt16* pMin
     // Otherwise, use the number at the end, to enable things like IP 
addresses.
     if ( nNum > nSign && ( cNext == 0 || cNext == ' ' || 
!CharClass::isAsciiNumeric(OUString(cLast)) ) )
     {   // number at the beginning
-        nVal = rValue.copy( 0, nNum ).toInt32();
+        nVal = comphelper::string::toInt32(rValue.subView( 0, nNum ));
         //  any number with a leading zero sets the minimum number of digits
         if ( p[nSign] == '0' && pMinDigits && ( nNum - nSign > *pMinDigits ) )
             *pMinDigits = nNum - nSign;
@@ -100,7 +100,7 @@ short lcl_DecompValueString( OUString& rValue, sal_Int32& 
nVal, sal_uInt16* pMin
         }
         if ( nNum < nEnd - nSign )
         {   // number at the end
-            nVal = rValue.copy( nNum + 1 ).toInt32();
+            nVal = comphelper::string::toInt32(rValue.subView( nNum + 1 ));
             //  any number with a leading zero sets the minimum number of 
digits
             if ( p[nNum+1+nSign] == '0' && pMinDigits && ( nEnd - nNum - nSign 
> *pMinDigits ) )
                 *pMinDigits = nEnd - nNum - nSign;
diff --git a/sc/source/filter/oox/formulaparser.cxx 
b/sc/source/filter/oox/formulaparser.cxx
index 4ade10d2e706..8ac06679ccfc 100644
--- a/sc/source/filter/oox/formulaparser.cxx
+++ b/sc/source/filter/oox/formulaparser.cxx
@@ -34,6 +34,7 @@
 #include <defnamesbuffer.hxx>
 #include <externallinkbuffer.hxx>
 #include <tablebuffer.hxx>
+#include <comphelper/string.hxx>
 
 namespace oox::xls {
 
@@ -1145,7 +1146,7 @@ const FunctionInfo* 
FormulaParserImpl::resolveBadFuncName( const OUString& rToke
     sal_Int32 nExclamation = rTokenData.indexOf( '!' );
     if( (0 == nBracketOpen) && (nBracketOpen + 1 < nBracketClose) && 
(nBracketClose + 1 == nExclamation) && (nExclamation + 1 < 
rTokenData.getLength()) )
     {
-        sal_Int32 nRefId = rTokenData.copy( nBracketOpen + 1, nBracketClose - 
nBracketOpen - 1 ).toInt32();
+        sal_Int32 nRefId = comphelper::string::toInt32(rTokenData.subView( 
nBracketOpen + 1, nBracketClose - nBracketOpen - 1 ));
         const ExternalLink* pExtLink = getExternalLinks().getExternalLink( 
nRefId ).get();
         if( pExtLink && (pExtLink->getLinkType() == ExternalLinkType::Library) 
)
         {
@@ -1739,7 +1740,7 @@ bool lclExtractRefId( sal_Int32& rnRefId, OUString& 
rRemainder, const OUString&
         sal_Int32 nBracketClose = rFormulaString.indexOf( ']', 1 );
         if( nBracketClose >= 2 )
         {
-            rnRefId = rFormulaString.copy( 1, nBracketClose - 1 ).toInt32();
+            rnRefId = comphelper::string::toInt32(rFormulaString.subView( 1, 
nBracketClose - 1 ));
             rRemainder = rFormulaString.copy( nBracketClose + 1 );
             return !rRemainder.isEmpty();
         }
diff --git a/sc/source/filter/oox/pagesettings.cxx 
b/sc/source/filter/oox/pagesettings.cxx
index 8946ea2d4d3d..e2a8aaa59a49 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -49,6 +49,7 @@
 #include <document.hxx>
 #include <biffhelper.hxx>
 #include <filter/msfilter/util.hxx>
+#include <comphelper/string.hxx>
 
 namespace oox::xls {
 
@@ -850,8 +851,8 @@ void HeaderFooterParser::convertFontColor( const OUString& 
rColor )
     if( (rColor[ 2 ] == '+') || (rColor[ 2 ] == '-') )
         // theme color: TTSNNN (TT = decimal theme index, S = +/-, NNN = 
decimal tint/shade in percent)
         maFontModel.maColor.setTheme(
-            rColor.copy( 0, 2 ).toInt32(),
-            static_cast< double >( rColor.copy( 2 ).toInt32() ) / 100.0 );
+            comphelper::string::toInt32(rColor.subView( 0, 2 )),
+            static_cast< double >( comphelper::string::toInt32(rColor.subView( 
2 )) ) / 100.0 );
     else
         // RGB color: RRGGBB
         maFontModel.maColor.setRgb( ::Color(ColorTransparency, 
rColor.toUInt32( 16 )) );
diff --git a/sc/source/filter/oox/sheetdatacontext.cxx 
b/sc/source/filter/oox/sheetdatacontext.cxx
index ddc3c9fd5eab..9b651c384c2f 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -29,6 +29,7 @@
 #include <formulaparser.hxx>
 #include <richstringcontext.hxx>
 #include <sal/log.hxx>
+#include <comphelper/string.hxx>
 
 namespace oox::xls {
 
@@ -295,11 +296,11 @@ void SheetDataContext::importRow( const AttributeList& 
rAttribs )
         if( (0 < nSepPos) && (nSepPos + 1 < aColSpanToken.getLength()) )
         {
             // OOXML uses 1-based integer column indexes, row model expects 
0-based colspans
-            const sal_Int32 nCol1 = aColSpanToken.copy( 0, nSepPos ).toInt32() 
- 1;
+            const sal_Int32 nCol1 = 
comphelper::string::toInt32(aColSpanToken.subView( 0, nSepPos )) - 1;
             const bool bValid1 = mrAddressConv.checkCol( nCol1, true);
             if (bValid1)
             {
-                const sal_Int32 nCol2 = aColSpanToken.copy( nSepPos + 1 
).toInt32() - 1;
+                const sal_Int32 nCol2 = 
comphelper::string::toInt32(aColSpanToken.subView( nSepPos + 1 )) - 1;
                 mrAddressConv.checkCol( nCol2, true);
                 aModel.insertColSpan( ValueRange( nCol1, ::std::min( nCol2, 
nMaxCol )));
             }
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 5d63fdbc87c5..519e612c01bc 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -26,6 +26,7 @@
 #include <sal/log.hxx>
 #include <unotools/charclass.hxx>
 #include <osl/module.hxx>
+#include <comphelper/string.hxx>
 
 #include <global.hxx>
 #include <docsh.hxx>
@@ -1257,8 +1258,8 @@ static bool lcl_PutString(
         {
             using namespace ::com::sun::star;
             bool bSecondCal = false;
-            sal_uInt16 nDay  = static_cast<sal_uInt16>(rStr.copy( nStart[nDP], 
nEnd[nDP]+1-nStart[nDP] ).toInt32());
-            sal_uInt16 nYear = static_cast<sal_uInt16>(rStr.copy( nStart[nYP], 
nEnd[nYP]+1-nStart[nYP] ).toInt32());
+            sal_uInt16 nDay  = 
static_cast<sal_uInt16>(comphelper::string::toInt32(rStr.subView( nStart[nDP], 
nEnd[nDP]+1-nStart[nDP] )));
+            sal_uInt16 nYear = 
static_cast<sal_uInt16>(comphelper::string::toInt32(rStr.subView( nStart[nYP], 
nEnd[nYP]+1-nStart[nYP] )));
             OUString aMStr = rStr.copy( nStart[nMP], nEnd[nMP]+1-nStart[nMP] );
             sal_Int16 nMonth = static_cast<sal_Int16>(aMStr.toInt32());
             if (!nMonth)
@@ -1323,11 +1324,11 @@ static bool lcl_PutString(
                 // time fields to zero (ICU calendar instance defaults to 
current date/time)
                 nHour = nMinute = nSecond = 0;
                 if (nFound > 3)
-                    nHour = static_cast<sal_Int16>(rStr.copy( nStart[3], 
nEnd[3]+1-nStart[3]).toInt32());
+                    nHour = 
static_cast<sal_Int16>(comphelper::string::toInt32(rStr.subView( nStart[3], 
nEnd[3]+1-nStart[3])));
                 if (nFound > 4)
-                    nMinute = static_cast<sal_Int16>(rStr.copy( nStart[4], 
nEnd[4]+1-nStart[4]).toInt32());
+                    nMinute = 
static_cast<sal_Int16>(comphelper::string::toInt32(rStr.subView( nStart[4], 
nEnd[4]+1-nStart[4])));
                 if (nFound > 5)
-                    nSecond = static_cast<sal_Int16>(rStr.copy( nStart[5], 
nEnd[5]+1-nStart[5]).toInt32());
+                    nSecond = 
static_cast<sal_Int16>(comphelper::string::toInt32(rStr.subView( nStart[5], 
nEnd[5]+1-nStart[5])));
                 // do not use calendar's milliseconds, to avoid fractional 
part truncation
                 double fFrac = 0.0;
                 if (nFound > 6)
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx 
b/sc/source/ui/miscdlgs/acredlin.cxx
index 300f6ad4a58d..b714f4d5e697 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -24,6 +24,7 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/basedlgs.hxx>
 #include <vcl/commandevent.hxx>
+#include <comphelper/string.hxx>
 
 #include <acredlin.hxx>
 #include <global.hxx>
@@ -1650,7 +1651,7 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const 
CommandEvent&, rCEvt, bool)
         }
         else
         {
-            int nDialogCol = sCommand.copy(8).toInt32();
+            int nDialogCol = comphelper::string::toInt32(sCommand.subView(8));
             pTheView->HeaderBarClick(nDialogCol);
         }
     }
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx 
b/sd/source/filter/xml/sdxmlwrp.cxx
index 906c3dc4f7f3..03a0a0d18b9b 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertysequence.hxx>
+#include <comphelper/string.hxx>
 #include <editeng/outlobj.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/docfilt.hxx>
@@ -695,11 +696,11 @@ bool SdXMLFilter::Import( ErrCode& nError )
                     sal_Int32 nIndex = sBuildId.indexOf('$');
                     if( nIndex != -1 )
                     {
-                        sal_Int32 nUPD = sBuildId.copy( 0, nIndex ).toInt32();
+                        sal_Int32 nUPD = 
comphelper::string::toInt32(sBuildId.subView( 0, nIndex ));
 
                         if( nUPD == 300 )
                         {
-                            sal_Int32 nBuildId = sBuildId.copy( nIndex+1 
).toInt32();
+                            sal_Int32 nBuildId = 
comphelper::string::toInt32(sBuildId.subView( nIndex+1 ));
                             if( (nBuildId > 0) && (nBuildId < 9316) )
                                 bTransform = true; // treat OOo 3.0 beta1 as 
OOo 2.x
                         }
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx 
b/sd/source/ui/presenter/PresenterTextView.cxx
index 81b2801ac5c1..53e9373a37d5 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -37,6 +37,7 @@
 #include <com/sun/star/rendering/XCanvas.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/i18n/ScriptType.hpp>
+#include <comphelper/string.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -369,11 +370,11 @@ sal_Int32 
PresenterTextView::Implementation::ParseDistance (const OUString& rsDi
     sal_Int32 nDistance (0);
     if (rsDistance.endsWith("px"))
     {
-        nDistance = rsDistance.copy(0,rsDistance.getLength()-2).toInt32();
+        nDistance = 
comphelper::string::toInt32(rsDistance.subView(0,rsDistance.getLength()-2));
     }
     else if (rsDistance.endsWith("l"))
     {
-        const sal_Int32 nLines 
(rsDistance.copy(0,rsDistance.getLength()-1).toInt32());
+        const sal_Int32 nLines 
(comphelper::string::toInt32(rsDistance.subView(0,rsDistance.getLength()-1)));
         // Take the height of the first line as the height of every line.
         const sal_uInt32 nFirstLineHeight (mpEditEngine->GetLineHeight(0));
         nDistance = nFirstLineHeight * nLines;
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 94fcdf924bdd..1b47ce57c3ba 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -46,6 +46,7 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
 #include <comphelper/storagehelper.hxx>
+#include <comphelper/string.hxx>
 #include <comphelper/synchronousdispatch.hxx>
 
 #include <svl/intitem.hxx>
@@ -595,7 +596,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
         {
             if ( aCommand.startsWith("slot:") )
             {
-                sal_uInt16 nSlotId = 
static_cast<sal_uInt16>(aCommand.copy(5).toInt32());
+                sal_uInt16 nSlotId = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aCommand.subView(5)));
                 if ( nSlotId == SID_OPENDOC )
                     pFileNameItem = nullptr;
             }
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 29fc51c22660..268e4dcf70fd 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -389,7 +389,7 @@ void 
SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI
     // Read version
     char cToken = ',';
     sal_Int32 nPos = aWinData.indexOf( cToken );
-    sal_uInt16 nActVersion = static_cast<sal_uInt16>(aWinData.copy( 0, nPos + 
1 ).toInt32());
+    sal_uInt16 nActVersion = 
static_cast<sal_uInt16>(comphelper::string::toInt32(aWinData.subView( 0, nPos + 
1 )));
     if ( nActVersion != nVersion )
         return;
 
@@ -406,12 +406,12 @@ void 
SfxChildWindow::InitializeChildWinFactory_Impl(sal_uInt16 nId, SfxChildWinI
     if ( nNextPos != -1 )
     {
         // there is extra information
-        rInfo.nFlags = 
static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1, 
nNextPos - nPos - 1 ).toInt32()));
+        rInfo.nFlags = 
static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(comphelper::string::toInt32(aWinData.subView(
 nPos+1, nNextPos - nPos - 1 ))));
         aWinData = aWinData.replaceAt( nPos, nNextPos-nPos+1, u"" );
         rInfo.aExtraString = aWinData;
     }
     else
-        rInfo.nFlags = 
static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(aWinData.copy( nPos+1 
).toInt32()));
+        rInfo.nFlags = 
static_cast<SfxChildWindowFlags>(static_cast<sal_uInt16>(comphelper::string::toInt32(aWinData.subView(
 nPos+1 ))));
 }
 
 bool ParentIsFloatingWindow(const vcl::Window *pParent)
diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx
index ae3a2d5e5684..7301949775ab 100644
--- a/sfx2/source/bastyp/mieclip.cxx
+++ b/sfx2/source/bastyp/mieclip.cxx
@@ -21,6 +21,7 @@
 
 #include <o3tl/safeint.hxx>
 #include <tools/stream.hxx>
+#include <comphelper/string.hxx>
 
 #include <sfx2/mieclip.hxx>
 
@@ -48,13 +49,13 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& 
rStream )
             nIndex = 0;
             OString sTmp(sLine.getToken(0, ':', nIndex));
             if (sTmp == "StartHTML")
-                nStt = sLine.copy(nIndex).toInt32();
+                nStt = comphelper::string::toInt32(sLine.subView(nIndex));
             else if (sTmp == "EndHTML")
-                nEnd = sLine.copy(nIndex).toInt32();
+                nEnd = comphelper::string::toInt32(sLine.subView(nIndex));
             else if (sTmp == "StartFragment")
-                nFragStart = sLine.copy(nIndex).toInt32();
+                nFragStart = 
comphelper::string::toInt32(sLine.subView(nIndex));
             else if (sTmp == "EndFragment")
-                nFragEnd = sLine.copy(nIndex).toInt32();
+                nFragEnd = comphelper::string::toInt32(sLine.subView(nIndex));
             else if (sTmp == "SourceURL")
                 sBaseURL = OStringToOUString( sLine.subView(nIndex), 
RTL_TEXTENCODING_UTF8 );
 
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index baa82c0bc0b3..382aa47ed591 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -78,6 +78,7 @@
 #include <comphelper/interaction.hxx>
 #include <comphelper/sequence.hxx>
 #include <comphelper/simplefileaccessinteraction.hxx>
+#include <comphelper/string.hxx>
 #include <framework/interaction.hxx>
 #include <utility>
 #include <svl/stritem.hxx>
@@ -3660,7 +3661,7 @@ void SfxMedium::AddVersion_Impl( util::RevisionTag& 
rRevision )
     sal_Int32 nLength = pImpl->aVersions.getLength();
     for ( const auto& rVersion : std::as_const(pImpl->aVersions) )
     {
-        sal_uInt32 nVer = static_cast<sal_uInt32>( 
rVersion.Identifier.copy(7).toInt32());
+        sal_uInt32 nVer = static_cast<sal_uInt32>( 
comphelper::string::toInt32(rVersion.Identifier.subView(7)));
         size_t n;
         for ( n=0; n<aLongs.size(); ++n )
             if ( nVer<aLongs[n] )
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index a0587f9bb079..b30690b57245 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -60,6 +60,7 @@
 #include <com/sun/star/util/InvalidStateException.hpp>
 #include <com/sun/star/util/CloseVetoException.hpp>
 #include <comphelper/enumhelper.hxx>
+#include <comphelper/string.hxx>
 
 #include <cppuhelper/implbase.hxx>
 #include <comphelper/multicontainer2.hxx>
@@ -3558,7 +3559,7 @@ static void ConvertSlotsToCommands( SfxObjectShell const 
* pDoc, Reference< cont
             GetCommandFromSequence( aCommand, nIndex, aSeqPropValue );
             if ( nIndex >= 0 && aCommand.startsWith( "slot:" ) )
             {
-                const sal_uInt16 nSlot = aCommand.copy( 5 ).toInt32();
+                const sal_uInt16 nSlot = 
comphelper::string::toInt32(aCommand.subView( 5 ));
 
                 // We have to replace the old "slot-Command" with our new 
".uno:-Command"
                 const SfxSlot* pSlot = pModule->GetSlotPool()->GetSlot( nSlot 
);
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 2f11ea8ae7b1..b5503ae55d46 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1614,7 +1614,7 @@ static bool lcl_matchKeywordAndGetNumber( const OUString 
& rString, const sal_In
 {
     if (0 <= nPos && nPos + rKeyword.getLength() < rString.getLength() && 
rString.matchIgnoreAsciiCase( rKeyword, nPos))
     {
-        nNumber = rString.copy( nPos + rKeyword.getLength()).toInt32();
+        nNumber = comphelper::string::toInt32(rString.subView( nPos + 
rKeyword.getLength()));
         return true;
     }
     else
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index e28c85b4a70b..f5a0d4161efb 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 
 #include <comphelper/propertyvalue.hxx>
+#include <comphelper/string.hxx>
 #include <o3tl/any.hxx>
 #include <svl/itempool.hxx>
 #include <editeng/memberids.h>
@@ -212,7 +213,7 @@ OUString NameOrIndex::CheckNamedItem( const NameOrIndex* 
pCheckItem, const sal_u
                         const OUString& aEntryName = pEntry->GetName();
                         if(aEntryName.getLength() >= aUser.getLength())
                         {
-                            sal_Int32 nThisIndex = aEntryName.copy( 
aUser.getLength() ).toInt32();
+                            sal_Int32 nThisIndex = 
comphelper::string::toInt32(aEntryName.subView( aUser.getLength() ));
                             if( nThisIndex >= nUserIndex )
                                 nUserIndex = nThisIndex + 1;
                         }
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 6fd9c72928c9..992f163084c3 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -83,6 +83,8 @@
 #include <strings.hrc>
 #include <frameformats.hxx>
 #include <tools/datetimeutils.hxx>
+#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
 
 #include <sortedobjs.hxx>
 
@@ -1272,12 +1274,12 @@ SwFlyFrameFormat* SwDoc::InsertDrawLabel(
     return pNewFormat;
 }
 
-static void lcl_collectUsedNums(std::vector<unsigned int>& rSetFlags, 
sal_Int32 nNmLen, const OUString& rName, std::u16string_view rCmpName)
+static void lcl_collectUsedNums(std::vector<unsigned int>& rSetFlags, 
sal_Int32 nNmLen, std::u16string_view rName, std::u16string_view rCmpName)
 {
-    if (rName.startsWith(rCmpName))
+    if (o3tl::starts_with(rName, rCmpName))
     {
         // Only get and set the Flag
-        const sal_Int32 nNum = rName.copy(nNmLen).toInt32() - 1;
+        const sal_Int32 nNum = 
comphelper::string::toInt32(rName.substr(nNmLen)) - 1;
         if (nNum >= 0)
             rSetFlags.push_back(nNum);
     }
@@ -1483,7 +1485,7 @@ void SwDoc::SetAllUniqueFlyNames()
 
                 if ( pNum )
                 {
-                    const sal_Int32 nNewLen = aNm.copy( nLen ).toInt32();
+                    const sal_Int32 nNewLen = 
comphelper::string::toInt32(aNm.subView( nLen ));
                     if (*pNum < nNewLen)
                         *pNum = nNewLen;
                 }
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 2cbfb7a6a4df..4c6c1da80880 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2610,7 +2610,7 @@ OUString SwDoc::GetUniqueNumRuleName( const OUString* 
pChkStr, bool bAutoNum ) c
             if( sNm.startsWith( aName ) )
             {
                 // Determine Number and set the Flag
-                nNum = o3tl::narrowing<sal_uInt16>(sNm.copy( nNmLen 
).toInt32());
+                nNum = 
o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(sNm.subView( nNmLen )));
                 if( nNum-- && nNum < mpNumRuleTable->size() )
                     pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
             }
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 9e6990247484..1905578b0646 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -21,6 +21,7 @@
 #include <hintids.hxx>
 #include <editeng/formatbreakitem.hxx>
 #include <comphelper/classids.hxx>
+#include <comphelper/string.hxx>
 #include <docsh.hxx>
 #include <ndole.hxx>
 #include <txttxmrk.hxx>
@@ -667,7 +668,7 @@ OUString SwDoc::GetUniqueTOXBaseName( const SwTOXType& 
rType,
             if ( rNm.startsWith(aName) )
             {
                 // Calculate number and set the Flag
-                nNum = rNm.copy( nNmLen ).toInt32();
+                nNum = comphelper::string::toInt32(rNm.subView( nNmLen ));
                 if( nNum-- && nNum < mpSectionFormatTable->size() )
                     pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
             }
diff --git a/sw/source/core/docnode/ndsect.cxx 
b/sw/source/core/docnode/ndsect.cxx
index 84f281b9fe91..da9c6d96a68c 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -60,6 +60,7 @@
 #include <memory>
 #include "ndsect.hxx"
 #include <tools/datetimeutils.hxx>
+#include <comphelper/string.hxx>
 
 // #i21457# - new implementation of local method <lcl_IsInSameTableBox(..)>.
 // Method now determines the previous/next on its own. Thus, it can be 
controlled,
@@ -1434,7 +1435,7 @@ OUString SwDoc::GetUniqueSectionName( const OUString* 
pChkStr ) const
             if (rNm.startsWith( aName ))
             {
                 // Calculate the Number and reset the Flag
-                nNum = rNm.copy( aName.getLength() ).toInt32();
+                nNum = comphelper::string::toInt32(rNm.subView( 
aName.getLength() ));
                 if( nNum-- && nNum < mpSectionFormatTable->size() )
                     pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
             }
diff --git a/sw/source/core/fields/cellfml.cxx 
b/sw/source/core/fields/cellfml.cxx
index 5c9632a7fb96..34aefecff0b3 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -789,7 +789,7 @@ static sal_Int32 lcl_GetLongBoxNum( OUString& rStr )
     }
     else
     {
-        nRet = rStr.copy( 0, nPos ).toInt32();
+        nRet = comphelper::string::toInt32(rStr.subView( 0, nPos ));
         rStr = rStr.copy( nPos+1 );
     }
     return nRet;
diff --git a/sw/source/core/unocore/XMLRangeHelper.cxx 
b/sw/source/core/unocore/XMLRangeHelper.cxx
index 4542469f5f94..3ce673e24042 100644
--- a/sw/source/core/unocore/XMLRangeHelper.cxx
+++ b/sw/source/core/unocore/XMLRangeHelper.cxx
@@ -20,7 +20,7 @@
 #include "XMLRangeHelper.hxx"
 #include <rtl/character.hxx>
 #include <rtl/ustrbuf.hxx>
-
+#include <comphelper/string.hxx>
 #include <algorithm>
 
 namespace
@@ -118,7 +118,7 @@ void lcl_getSingleCellAddressFromXMLString(
     // parse number for row
     while( rtl::isAsciiDigit( pStrArray[ i ] ) && i >= 0 )
         i--;
-    rOutCell.nRow = (aCellStr.copy( i + 1 )).toInt32() - 1;
+    rOutCell.nRow = (comphelper::string::toInt32(aCellStr.subView( i + 1 ))) - 
1;
     // a dollar in XML means absolute (whereas in UI it means relative)
     if( pStrArray[ i ] == aDollar )
     {
diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index 39ebb99e2355..4bb64a369220 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -387,7 +387,7 @@ void SwXTextTable::GetCellPosition(const OUString& 
rCellName, sal_Int32& o_rColu
     }
 
     o_rColumn = nColIdx;
-    o_rRow    = rCellName.copy(nRowPos).toInt32() - 1; // - 1 because indices 
ought to be 0 based
+    o_rRow    = comphelper::string::toInt32(rCellName.subView(nRowPos)) - 1; 
// - 1 because indices ought to be 0 based
 }
 
 /** compare position of two cells (check rows first)
diff --git a/sw/source/filter/html/htmlatr.cxx 
b/sw/source/filter/html/htmlatr.cxx
index db17987ff468..cefef48647dc 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -76,6 +76,7 @@
 #include <deque>
 
 #include <svtools/HtmlWriter.hxx>
+#include <o3tl/string_view.hxx>
 
 #include <memory>
 #include <algorithm>
@@ -92,7 +93,7 @@ HTMLOutEvent const aAnchorEventTable[] =
 
 static Writer& OutHTML_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt );
 
-sal_uInt16 SwHTMLWriter::GetDefListLvl( const OUString& rNm, sal_uInt16 
nPoolId )
+sal_uInt16 SwHTMLWriter::GetDefListLvl( std::u16string_view rNm, sal_uInt16 
nPoolId )
 {
     if( nPoolId == RES_POOLCOLL_HTML_DD )
     {
@@ -104,14 +105,14 @@ sal_uInt16 SwHTMLWriter::GetDefListLvl( const OUString& 
rNm, sal_uInt16 nPoolId
     }
 
     OUString sDTDD = OOO_STRING_SVTOOLS_HTML_dt " ";
-    if( rNm.startsWith(sDTDD) )
+    if( o3tl::starts_with(rNm, sDTDD) )
         // DefinitionList - term
-        return o3tl::narrowing<sal_uInt16>(rNm.copy( sDTDD.getLength() 
).toInt32()) | HTML_DLCOLL_DT;
+        return 
o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rNm.substr( 
sDTDD.getLength() ))) | HTML_DLCOLL_DT;
 
     sDTDD = OOO_STRING_SVTOOLS_HTML_dd " ";
-    if( rNm.startsWith(sDTDD) )
+    if( o3tl::starts_with(rNm, sDTDD) )
         // DefinitionList - definition
-        return o3tl::narrowing<sal_uInt16>(rNm.copy( sDTDD.getLength() 
).toInt32()) | HTML_DLCOLL_DD;
+        return 
o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rNm.substr( 
sDTDD.getLength() ))) | HTML_DLCOLL_DD;
 
     return 0;
 }
diff --git a/sw/source/filter/html/wrthtml.hxx 
b/sw/source/filter/html/wrthtml.hxx
index 0ad4728dc143..fc3d01eecd2b 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -571,7 +571,7 @@ public:
     static void GetEEAttrsFromDrwObj( SfxItemSet& rItemSet,
                                       const SdrObject *pObj );
 
-    static sal_uInt16 GetDefListLvl( const OUString& rNm, sal_uInt16 nPoolId );
+    static sal_uInt16 GetDefListLvl( std::u16string_view rNm, sal_uInt16 
nPoolId );
 
     sal_uInt32 GetHTMLMode() const
     {
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx 
b/sw/source/filter/ww8/wrtww8gr.cxx
index 78cecb7224a4..cf0c6fd4c7a5 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -60,6 +60,7 @@
 
 #include <IDocumentDrawModelAccess.hxx>
 #include <drawdoc.hxx>
+#include <comphelper/string.hxx>
 
 using namespace ::com::sun::star;
 
@@ -339,7 +340,7 @@ void WW8Export::OutputLinkedOLE( const OUString& rOleId )
     // Output the cPicLocation attribute
     std::unique_ptr<ww::bytes> pBuf( new ww::bytes );
     SwWW8Writer::InsUInt16( *pBuf, NS_sprm::CPicLocation::val );
-    SwWW8Writer::InsUInt32( *pBuf, rOleId.copy( 1 ).toInt32() );
+    SwWW8Writer::InsUInt32( *pBuf, comphelper::string::toInt32(rOleId.subView( 
1 )) );
 
     SwWW8Writer::InsUInt16( *pBuf, NS_sprm::CFOle2::val );
     pBuf->push_back( 1 );
diff --git a/sw/source/ui/vba/vbaparagraphformat.cxx 
b/sw/source/ui/vba/vbaparagraphformat.cxx
index 683a3a5befcc..68f3a16219c3 100644
--- a/sw/source/ui/vba/vbaparagraphformat.cxx
+++ b/sw/source/ui/vba/vbaparagraphformat.cxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/style/BreakType.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include "vbatabstops.hxx"
+#include <comphelper/string.hxx>
 
 using namespace ::ooo::vba;
 using namespace ::com::sun::star;
@@ -187,7 +188,7 @@ sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel()
     if( aHeading.startsWith( HEADING ) )
     {
         // get the sub string after "Heading"
-        nLevel = aHeading.copy( HEADING.getLength() ).toInt32();
+        nLevel = comphelper::string::toInt32(aHeading.subView( 
HEADING.getLength() ));
     }
     return nLevel;
 }
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 92514a5e1486..23c4f1c1464e 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -26,6 +26,7 @@
 #include <comphelper/fileformat.h>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/propertyvalue.hxx>
+#include <comphelper/string.hxx>
 
 #include <sal/log.hxx>
 #include <edtwin.hxx>
@@ -1080,7 +1081,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
                             }
                             else if ( sTmpl.startsWith(aOutline) )
                             {
-                                nTemplateOutlineLevel = 
sTmpl.copy(aOutline.getLength()).toInt32(); //get string behind "Outline: Level 
 ";
+                                nTemplateOutlineLevel = 
comphelper::string::toInt32(sTmpl.subView(aOutline.getLength())); //get string 
behind "Outline: Level  ";
                                 bCreateByOutlineLevel = true;
                             }
 
diff --git a/sw/source/uibase/fldui/fldmgr.cxx 
b/sw/source/uibase/fldui/fldmgr.cxx
index 90fdaad22a1d..e4b1597bc9f2 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1233,7 +1233,7 @@ bool SwFieldMgr::InsertField(
                     nExpPos = rData.m_sPar1.indexOf(DB_DELIM, nCmdTypePos);
                     if (nExpPos>=0)
                     {
-                        aDBData.nCommandType = rData.m_sPar1.copy(nCmdTypePos, 
nExpPos++ - nCmdTypePos).toInt32();
+                        aDBData.nCommandType = 
comphelper::string::toInt32(rData.m_sPar1.subView(nCmdTypePos, nExpPos++ - 
nCmdTypePos));
                     }
                 }
             }
@@ -1631,7 +1631,7 @@ void SwFieldMgr::UpdateCurField(sal_uInt32 nFormat,
                 static_cast<SwGetRefField*>(pTmpField.get())->SetSubType( 
o3tl::narrowing<sal_uInt16>(rPar2.toInt32()) );
                 const sal_Int32 nPos = rPar2.indexOf( '|' );
                 if( nPos>=0 )
-                    static_cast<SwGetRefField*>(pTmpField.get())->SetSeqNo( 
o3tl::narrowing<sal_uInt16>(rPar2.copy( nPos + 1 ).toInt32()));
+                    static_cast<SwGetRefField*>(pTmpField.get())->SetSeqNo( 
o3tl::narrowing<sal_uInt16>(comphelper::string::toInt32(rPar2.subView( nPos + 1 
))));
             }
             break;
         case SwFieldTypesEnum::Dropdown:
diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index dd5feeacc747..dea682f77d11 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -33,6 +33,7 @@
 #include <redlndlg.hxx>
 #include <swwait.hxx>
 #include <uitool.hxx>
+#include <comphelper/string.hxx>
 
 #include <cmdid.h>
 #include <strings.hrc>
@@ -1287,7 +1288,7 @@ IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const 
CommandEvent&, rCEvt, bool)
     }
     else if (!sCommand.isEmpty())
     {
-        int nSortMode = sCommand.copy(10).toInt32();
+        int nSortMode = comphelper::string::toInt32(sCommand.subView(10));
 
         if (nSortMode == 4 && nColumn == 4)
             return true;  // we already have it
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 2b976f28b46f..8484919c5a58 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -116,6 +116,7 @@
 #include <dbmgr.hxx>
 #include <reffld.hxx>
 #include <comphelper/lok.hxx>
+#include <comphelper/string.hxx>
 
 #include <PostItMgr.hxx>
 
@@ -2159,7 +2160,7 @@ auto PrepareJumpToTOXMark(SwDoc const& rDoc, OUString 
const& rName)
         SAL_WARN("sw.ui", "JumpToTOXMark: missing separator");
         return std::optional<std::pair<SwTOXMark, sal_Int32>>();
     }
-    sal_Int32 const counter(rName.copy(0, first).toInt32());
+    sal_Int32 const counter(comphelper::string::toInt32(rName.subView(0, 
first)));
     if (counter <= 0)
     {
         SAL_WARN("sw.ui", "JumpToTOXMark: invalid counter");
@@ -2306,7 +2307,7 @@ bool SwView::JumpToSwMark( std::u16string_view rMark )
                 sal_Int32 nNoPos = sName.indexOf( cSequenceMarkSeparator );
                 if ( nNoPos != -1 )
                 {
-                    sal_uInt16 nSeqNo = sName.copy( nNoPos + 1 ).toInt32();
+                    sal_uInt16 nSeqNo = 
comphelper::string::toInt32(sName.subView( nNoPos + 1 ));
                     sName = sName.copy( 0, nNoPos );
                     bRet = m_pWrtShell->GotoRefMark(sName, REF_SEQUENCEFLD, 
nSeqNo);
                 }
diff --git a/ucbhelper/source/client/proxydecider.cxx 
b/ucbhelper/source/client/proxydecider.cxx
index 1e2b0adfd2d2..1d46d8ca9a29 100644
--- a/ucbhelper/source/client/proxydecider.cxx
+++ b/ucbhelper/source/client/proxydecider.cxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/util/XChangesNotifier.hpp>
 #include <cppuhelper/implbase.hxx>
 #include <ucbhelper/proxydecider.hxx>
+#include <comphelper/string.hxx>
 
 #ifdef _WIN32
 #include <o3tl/char16_t2wchar_t.hxx>
@@ -518,7 +519,7 @@ DWORD WINAPI GetPACProxyThread(_In_ LPVOID lpParameter)
             sal_Int32 nPortSepPos = sProxyResult.indexOf(':');
             if (nPortSepPos != -1)
             {
-                pData->m_ProxyServer.nPort = sProxyResult.copy(nPortSepPos + 
1).toInt32();
+                pData->m_ProxyServer.nPort = 
comphelper::string::toInt32(sProxyResult.subView(nPortSepPos + 1));
                 sProxyResult = sProxyResult.copy(0, nPortSepPos);
             }
             else
@@ -590,7 +591,7 @@ InternetProxyServer GetUnixSystemProxy(const OUString & 
rProtocol)
     sal_Int32 x = tmp.indexOf(':');
     if (x == -1)
         return aProxy;
-    int nPort = tmp.copy(x + 1).toInt32();
+    int nPort = comphelper::string::toInt32(tmp.subView(x + 1));
     if (nPort == 0)
         return aProxy;
     aProxy.aName = tmp.copy(0, x);
diff --git a/unotools/source/config/dynamicmenuoptions.cxx 
b/unotools/source/config/dynamicmenuoptions.cxx
index 8598eb494624..98c8aac403de 100644
--- a/unotools/source/config/dynamicmenuoptions.cxx
+++ b/unotools/source/config/dynamicmenuoptions.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <comphelper/string.hxx>
 
 #include <vector>
 #include <algorithm>
@@ -287,14 +288,13 @@ static void lcl_SortAndExpandPropertyNames( const 
Sequence< OUString >& lSource
 {
     struct CountWithPrefixSort
     {
-        bool operator() ( const OUString& s1 ,
-                         const OUString& s2 ) const
+        bool operator() ( std::u16string_view s1, std::u16string_view s2 ) 
const
         {
             // Get order numbers from entry name without prefix.
             // e.g. "m10" => 10
             //      "m5"  => 5
-            sal_Int32 n1 = s1.copy( 1 ).toInt32();
-            sal_Int32 n2 = s2.copy( 1 ).toInt32();
+            sal_Int32 n1 = comphelper::string::toInt32(s1.substr( 1 ));
+            sal_Int32 n2 = comphelper::string::toInt32(s2.substr( 1 ));
             // MUST be in [0,1] ... because it's a difference between
             // insert-positions of given entries in sorted list!
             return( n1<n2 );
diff --git a/vbahelper/source/vbahelper/vbalineformat.cxx 
b/vbahelper/source/vbahelper/vbalineformat.cxx
index 0045bd0f7f2c..1adaf286e817 100644
--- a/vbahelper/source/vbahelper/vbalineformat.cxx
+++ b/vbahelper/source/vbahelper/vbalineformat.cxx
@@ -104,7 +104,7 @@ ScVbaLineFormat::getBeginArrowheadStyle()
     {
         sal_Int32 nIndex = sLineName.indexOf( ' ' );
         OUString sName = sLineName.copy( 0, nIndex );
-        //sal_Int32 nSize = sLineName.copy( nIndex + 1 ).toInt32();
+        //sal_Int32 nSize = comphelper::string::toInt32(sLineName.subView( 
nIndex + 1 ));
         nLineType = convertLineStartEndNameToArrowheadStyle( sName );
     }
     else
diff --git a/vcl/inc/ppdparser.hxx b/vcl/inc/ppdparser.hxx
index 48e47e3fbc13..cd565ef761eb 100644
--- a/vcl/inc/ppdparser.hxx
+++ b/vcl/inc/ppdparser.hxx
@@ -214,7 +214,7 @@ public:
 
     void            getDefaultResolution( int& rXRes, int& rYRes ) const;
     // values in dpi
-    static void     getResolutionFromString( const OUString&, int&, int& );
+    static void     getResolutionFromString( std::u16string_view, int&, int& );
     // helper function
 
     OUString   translateKey( const OUString& i_rKey ) const;
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 67c0357a8ebf..95dff5f634e2 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -1195,7 +1195,7 @@ static sal_uInt16 ImplCutNumberFromString( OUString& rStr 
)
     while (i2 != rStr.getLength() && rStr[i2] >= '0' && rStr[i2] <= '9') {
         ++i2;
     }
-    sal_Int32 nValue = rStr.copy(i1, i2-i1).toInt32();
+    sal_Int32 nValue = comphelper::string::toInt32(rStr.subView(i1, i2-i1));
     rStr = rStr.copy(std::min(i2+1, rStr.getLength()));
     return nValue;
 }
@@ -2410,7 +2410,7 @@ bool TimeFormatter::TextToTime(std::u16string_view rStr, 
tools::Time& rTime,
     }
     else
     {
-        nSecond = static_cast<short>(aStr.copy( 0, nSepPos 
).makeStringAndClear().toInt32());
+        nSecond = static_cast<short>(comphelper::string::toInt32(aStr.subView( 
0, nSepPos )));
         aStr.remove( 0, nSepPos+1 );
 
         nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() );
@@ -2419,7 +2419,7 @@ bool TimeFormatter::TextToTime(std::u16string_view rStr, 
tools::Time& rTime,
         if ( nSepPos >= 0 )
         {
             nMinute = nSecond;
-            nSecond = static_cast<short>(aStr.copy( 0, nSepPos 
).makeStringAndClear().toInt32());
+            nSecond = 
static_cast<short>(comphelper::string::toInt32(aStr.subView( 0, nSepPos )));
             aStr.remove( 0, nSepPos+1 );
 
             nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() );
@@ -2429,7 +2429,7 @@ bool TimeFormatter::TextToTime(std::u16string_view rStr, 
tools::Time& rTime,
             {
                 nHour   = nMinute;
                 nMinute = nSecond;
-                nSecond = static_cast<short>(aStr.copy( 0, nSepPos 
).makeStringAndClear().toInt32());
+                nSecond = 
static_cast<short>(comphelper::string::toInt32(aStr.subView( 0, nSepPos )));
                 aStr.remove( 0, nSepPos+1 );
             }
             else
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index e6abb40ccb89..e3f9baa98897 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -24,6 +24,7 @@
 #include <vcl/bitmap.hxx>
 #include <tools/stream.hxx>
 #include <tools/UnitConversion.hxx>
+#include <comphelper/string.hxx>
 
 #include <bitmap/BitmapWriteAccess.hxx>
 
@@ -581,12 +582,12 @@ util::DateTime PDFiumSignatureImpl::getTime()
     OString aM(aTimeBuf.data(), aTimeBuf.size() - 1);
     if (aM.startsWith("D:") && aM.getLength() >= 16)
     {
-        aRet.Year = aM.copy(2, 4).toInt32();
-        aRet.Month = aM.copy(6, 2).toInt32();
-        aRet.Day = aM.copy(8, 2).toInt32();
-        aRet.Hours = aM.copy(10, 2).toInt32();
-        aRet.Minutes = aM.copy(12, 2).toInt32();
-        aRet.Seconds = aM.copy(14, 2).toInt32();
+        aRet.Year = comphelper::string::toInt32(aM.subView(2, 4));
+        aRet.Month = comphelper::string::toInt32(aM.subView(6, 2));
+        aRet.Day = comphelper::string::toInt32(aM.subView(8, 2));
+        aRet.Hours = comphelper::string::toInt32(aM.subView(10, 2));
+        aRet.Minutes = comphelper::string::toInt32(aM.subView(12, 2));
+        aRet.Seconds = comphelper::string::toInt32(aM.subView(14, 2));
     }
     return aRet;
 }
diff --git a/vcl/unx/generic/printer/jobdata.cxx 
b/vcl/unx/generic/printer/jobdata.cxx
index 79d5cfd39ed4..5d7d432bb114 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -21,6 +21,7 @@
 #include <jobdata.hxx>
 #include <printerinfomanager.hxx>
 #include <tools/stream.hxx>
+#include <comphelper/string.hxx>
 
 #include <rtl/strbuf.hxx>
 #include <memory>
@@ -231,7 +232,7 @@ bool JobData::constructFromStreamBuffer( const void* pData, 
sal_uInt32 bytes, Jo
         else if (aLine.startsWith(copiesEquals))
         {
             bCopies = true;
-            rJobData.m_nCopies = 
aLine.copy(RTL_CONSTASCII_LENGTH(copiesEquals)).toInt32();
+            rJobData.m_nCopies = 
comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(copiesEquals)));
         }
         else if (aLine.startsWith(collateEquals))
         {
@@ -249,22 +250,22 @@ bool JobData::constructFromStreamBuffer( const void* 
pData, sal_uInt32 bytes, Jo
         else if (aLine.startsWith(colordepthEquals))
         {
             bColorDepth = true;
-            rJobData.m_nColorDepth = 
aLine.copy(RTL_CONSTASCII_LENGTH(colordepthEquals)).toInt32();
+            rJobData.m_nColorDepth = 
comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordepthEquals)));
         }
         else if (aLine.startsWith(colordeviceEquals))
         {
             bColorDevice = true;
-            rJobData.m_nColorDevice = 
aLine.copy(RTL_CONSTASCII_LENGTH(colordeviceEquals)).toInt32();
+            rJobData.m_nColorDevice = 
comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(colordeviceEquals)));
         }
         else if (aLine.startsWith(pslevelEquals))
         {
             bPSLevel = true;
-            rJobData.m_nPSLevel = 
aLine.copy(RTL_CONSTASCII_LENGTH(pslevelEquals)).toInt32();
+            rJobData.m_nPSLevel = 
comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pslevelEquals)));
         }
         else if (aLine.startsWith(pdfdeviceEquals))
         {
             bPDFDevice = true;
-            rJobData.m_nPDFDevice = 
aLine.copy(RTL_CONSTASCII_LENGTH(pdfdeviceEquals)).toInt32();
+            rJobData.m_nPDFDevice = 
comphelper::string::toInt32(aLine.subView(RTL_CONSTASCII_LENGTH(pdfdeviceEquals)));
         }
         else if (aLine == "PPDContextData" && bPrinter)
         {
diff --git a/vcl/unx/generic/printer/ppdparser.cxx 
b/vcl/unx/generic/printer/ppdparser.cxx
index f9309413825e..ba68e1ef011e 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1515,23 +1515,22 @@ OUString PPDParser::getDefaultInputSlot() const
     return OUString();
 }
 
-void PPDParser::getResolutionFromString(
-                                        const OUString& rString,
+void PPDParser::getResolutionFromString(std::u16string_view rString,
                                         int& rXRes, int& rYRes )
 {
     rXRes = rYRes = 300;
 
-    const sal_Int32 nDPIPos {rString.indexOf( "dpi" )};
-    if( nDPIPos != -1 )
+    const size_t nDPIPos {rString.find( u"dpi" )};
+    if( nDPIPos != std::u16string_view::npos )
     {
-        const sal_Int32 nPos {rString.indexOf( 'x' )};
-        if( nPos >=0 )
+        const size_t nPos {rString.find( 'x' )};
+        if( nPos != std::u16string_view::npos )
         {
-            rXRes = rString.copy( 0, nPos ).toInt32();
-            rYRes = rString.copy(nPos+1, nDPIPos - nPos - 1).toInt32();
+            rXRes = comphelper::string::toInt32(rString.substr( 0, nPos ));
+            rYRes = comphelper::string::toInt32(rString.substr(nPos+1, nDPIPos 
- nPos - 1));
         }
         else
-            rXRes = rYRes = rString.copy( 0, nDPIPos ).toInt32();
+            rXRes = rYRes = comphelper::string::toInt32(rString.substr( 0, 
nDPIPos ));
     }
 }
 
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx 
b/writerfilter/source/dmapper/ConversionHelper.cxx
index 59e2e48d68be..ec74bad06625 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -27,6 +27,7 @@
 #include <tools/color.hxx>
 #include <tools/mapunit.hxx>
 #include <tools/UnitConversion.hxx>
+#include <comphelper/string.hxx>
 
 using namespace com::sun::star;
 
@@ -673,13 +674,13 @@ util::DateTime ConvertDateStringToDateTime( const 
OUString& rDateTime )
     aDateTime.Year = sal_uInt16( sDate.getToken( 0, '-', nIndex ).toInt32() );
     aDateTime.Month = sal_uInt16( sDate.getToken( 0, '-', nIndex ).toInt32() );
     if (nIndex != -1)
-        aDateTime.Day = sal_uInt16( sDate.copy( nIndex ).toInt32() );
+        aDateTime.Day = sal_uInt16( comphelper::string::toInt32(sDate.subView( 
nIndex )) );
 
     nIndex = 0;
     aDateTime.Hours = sal_uInt16( sTime.getToken( 0, ':', nIndex ).toInt32() );
     aDateTime.Minutes = sal_uInt16( sTime.getToken( 0, ':', nIndex ).toInt32() 
);
     if (nIndex != -1)
-        aDateTime.Seconds = sal_uInt16( sTime.copy( nIndex ).toInt32() );
+        aDateTime.Seconds = sal_uInt16( 
comphelper::string::toInt32(sTime.subView( nIndex )) );
 
     return aDateTime;
 }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 672f78d27d39..b032726fed1d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -89,6 +89,7 @@
 #include <rtl/uri.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/streamwrap.hxx>
+#include <comphelper/string.hxx>
 
 #include <dmapper/GraphicZOrderHelper.hxx>
 
@@ -475,7 +476,7 @@ OUString DomainMapper_Impl::GetUnusedPageStyleName()
         {
             if ( rStyleName.startsWith( DEFAULT_STYLE ) )
             {
-                sal_Int32 nIndex = rStyleName.copy( strlen( DEFAULT_STYLE ) 
).toInt32();
+                sal_Int32 nIndex = 
comphelper::string::toInt32(rStyleName.subView( strlen( DEFAULT_STYLE ) ));
                 if ( nIndex > nMaxIndex )
                     nMaxIndex = nIndex;
             }
@@ -5759,7 +5760,7 @@ void DomainMapper_Impl::handleToc
         {
             sal_Int32 nIndex = 0;
             sValue.getToken( 0, '-', nIndex );
-            nMaxLevel = static_cast<sal_Int16>(nIndex != -1 ? 
sValue.copy(nIndex).toInt32() : 0);
+            nMaxLevel = static_cast<sal_Int16>(nIndex != -1 ? 
comphelper::string::toInt32(sValue.subView(nIndex)) : 0);
         }
     }
 //                  \p Defines the separator between the table entry and its 
page number
@@ -6369,7 +6370,7 @@ void DomainMapper_Impl::CloseFieldCommand()
                                 if (nStartIndex > 0 && nEndIndex > 0)
                                 {
                                     // nDown is the requested "lower by" value 
in points.
-                                    sal_Int32 nDown = aCommand.copy(0, 
nStartIndex).toInt32();
+                                    sal_Int32 nDown = 
comphelper::string::toInt32(aCommand.subView(0, nStartIndex));
                                     OUString aContent = 
aCommand.copy(nStartIndex + 1, nEndIndex - nStartIndex - 1);
                                     PropertyMapPtr pCharContext = 
GetTopContext();
                                     // dHeight is the font size of the current 
style.
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 47349ac8aaba..2df00afc239a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -63,14 +63,14 @@ util::DateTime getDateTimeFromUserProp(const OUString& 
rString)
     sal_Int32 nLen = rString.getLength();
     if (nLen >= 4)
     {
-        aRet.Year = rString.copy(0, 4).toInt32();
+        aRet.Year = comphelper::string::toInt32(rString.subView(0, 4));
 
         if (nLen >= 8 && rString.match(". ", 4))
         {
-            aRet.Month = rString.copy(6, 2).toInt32();
+            aRet.Month = comphelper::string::toInt32(rString.subView(6, 2));
 
             if (nLen >= 12 && rString.match(". ", 8))
-                aRet.Day = rString.copy(10, 2).toInt32();
+                aRet.Day = comphelper::string::toInt32(rString.subView(10, 2));
         }
     }
     return aRet;
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx 
b/xmloff/source/chart/SchXMLChartContext.cxx
index 331a928feb97..b5aaf117cf45 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -57,6 +57,7 @@
 
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <comphelper/string.hxx>
 
 using namespace com::sun::star;
 using namespace ::xmloff::token;
@@ -180,7 +181,7 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( 
const OUString& rStr
         nPos = rStr.indexOf( aSpace, nLastPos );
         if( nPos > nLastPos )
         {
-            aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() 
);
+            aVec.push_back( comphelper::string::toInt32(rStr.subView( 
nLastPos, (nPos - nLastPos) )) );
         }
         if( nPos != -1 )
             nLastPos = nPos + 1;
@@ -189,7 +190,7 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( 
const OUString& rStr
     if( nLastPos != 0 &&
         rStr.getLength() > nLastPos )
     {
-        aVec.push_back( rStr.copy( nLastPos ).toInt32() );
+        aVec.push_back( comphelper::string::toInt32(rStr.subView( nLastPos )) 
);
     }
 
     const sal_Int32 nVecSize = aVec.size();
diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx 
b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
index 4884d0ba5823..1e61b1f52a58 100644
--- a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
+++ b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
@@ -21,6 +21,7 @@
 
 #include <o3tl/safeint.hxx>
 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
+#include <comphelper/string.hxx>
 #include <algorithm>
 
 using namespace ::com::sun::star;
@@ -94,7 +95,7 @@ bool UnoInterfaceToUniqueIdentifierMapper::registerReference( 
const OUString& rI
         // the identifier is a pure integer value
         // so we make sure we will never generate
         // an integer value like this one
-        sal_Int32 nId = rIdentifier.copy(2).toInt32();
+        sal_Int32 nId = comphelper::string::toInt32(rIdentifier.subView(2));
         if (nId > 0 && mnNextId <= o3tl::make_unsigned(nId))
             mnNextId = nId + 1;
 
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a710e87b3bb7..e18769e9f6a4 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -62,6 +62,7 @@
 #include <comphelper/fileformat.h>
 #include <comphelper/namecontainer.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <comphelper/extract.hxx>
@@ -1829,11 +1830,11 @@ bool SvXMLImport::getBuildIds( sal_Int32& rUPD, 
sal_Int32& rBuild ) const
         sal_Int32 nIndex = aBuildId.indexOf('$');
         if (nIndex != -1)
         {
-            rUPD = aBuildId.copy( 0, nIndex ).toInt32();
+            rUPD = comphelper::string::toInt32(aBuildId.subView( 0, nIndex ));
             sal_Int32 nIndexEnd = aBuildId.indexOf(';', nIndex);
             rBuild = (nIndexEnd == -1)
-                ? aBuildId.copy(nIndex + 1).toInt32()
-                : aBuildId.copy(nIndex + 1, nIndexEnd - nIndex - 1).toInt32();
+                ? comphelper::string::toInt32(aBuildId.subView(nIndex + 1))
+                : comphelper::string::toInt32(aBuildId.subView(nIndex + 1, 
nIndexEnd - nIndex - 1));
             bRet = true;
         }
     }
diff --git a/xmloff/source/xforms/SchemaRestrictionContext.cxx 
b/xmloff/source/xforms/SchemaRestrictionContext.cxx
index ea6db4f1befb..68da0bdd95c9 100644
--- a/xmloff/source/xforms/SchemaRestrictionContext.cxx
+++ b/xmloff/source/xforms/SchemaRestrictionContext.cxx
@@ -38,6 +38,7 @@
 #include <com/sun/star/xsd/DataTypeClass.hpp>
 #include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
 
+#include <comphelper/string.hxx>
 #include <sal/log.hxx>
 #include <tools/diagnose_ex.h>
 
@@ -150,11 +151,11 @@ static Any xforms_date( const OUString& rValue )
     {
         util::Date aDate;
         aDate.Year = static_cast<sal_uInt16>(
-                     rValue.copy( 0, nPos1 ).toInt32() );
+                     comphelper::string::toInt32(rValue.subView( 0, nPos1 )) );
         aDate.Month = static_cast<sal_uInt16>(
-                      rValue.copy( nPos1 + 1, nPos2 - nPos1 - 1 ).toInt32() );
+                      comphelper::string::toInt32(rValue.subView( nPos1 + 1, 
nPos2 - nPos1 - 1 )) );
         aDate.Day   = static_cast<sal_uInt16>(
-                      rValue.copy( nPos2 + 1 ).toInt32() );
+                      comphelper::string::toInt32(rValue.subView( nPos2 + 1 )) 
);
         aAny <<= aDate;
     }
     return aAny;

Reply via email to