diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-10 12:09:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-11 08:44:09 +0200 |
commit | 71337b4327805b73e92c995153c5746d89793b13 (patch) | |
tree | fd66764b57912cb2a8b86618e97f1e90d607d2cd /sw/source/ui/dbui/dbinsdlg.cxx | |
parent | bab44a97d21d0ac8a8a06678e71024c1a830943f (diff) |
use more string_view in sw
Change-Id: Ibefb8549834ba5011286e3221f1ae276e2c0c0bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141153
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/ui/dbui/dbinsdlg.cxx')
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index da3632e0d1a5..41abd6f318c6 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -811,21 +811,22 @@ IMPL_LINK_NOARG(SwInsertDBColAutoPilot, HeaderHdl, weld::Toggleable&, void) m_xRbHeadlEmpty->set_sensitive( bEnable ); } -static void lcl_InsTextInArr( const OUString& rText, DB_Columns& rColArr ) +static void lcl_InsTextInArr( std::u16string_view aText, DB_Columns& rColArr ) { - sal_Int32 nSttPos = 0, nFndPos; - while( -1 != ( nFndPos = rText.indexOf( '\x0A', nSttPos )) ) + size_t nSttPos = 0; + size_t nFndPos; + while( std::u16string_view::npos != ( nFndPos = aText.find( '\x0A', nSttPos )) ) { if( 1 < nFndPos ) { - rColArr.push_back(std::make_unique<DB_Column>(rText.copy(nSttPos, nFndPos -1))); + rColArr.push_back(std::make_unique<DB_Column>(OUString(aText.substr(nSttPos, nFndPos -1)))); } rColArr.push_back(std::make_unique<DB_Column>()); nSttPos = nFndPos + 1; } - if( nSttPos < rText.getLength() ) + if( nSttPos < aText.size() ) { - rColArr.push_back(std::make_unique<DB_Column>(rText.copy(nSttPos))); + rColArr.push_back(std::make_unique<DB_Column>(OUString(aText.substr(nSttPos)))); } } @@ -858,7 +859,7 @@ bool SwInsertDBColAutoPilot::SplitTextToColArr( const OUString& rText, if( 1 < nSttPos ) { - ::lcl_InsTextInArr( sText.copy( 0, nSttPos-1 ), rColArr ); + ::lcl_InsTextInArr( sText.subView( 0, nSttPos-1 ), rColArr ); sText = sText.copy( nSttPos-1 ); } |