tdf#171853 use endsWith instead of lastIndexOf+getLength in comphelper

Change-Id: I8e18fab55e86d912673698b284ddc89b59342bef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204354
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
subhanigc
2026-04-28 08:48:06 +02:00
committed by Neil Roberts
parent fc76052495
commit 8ac7d04229
+1 -5
View File
@@ -120,12 +120,8 @@ namespace comphelper {
Reference< XStorable > xDocStorable( _rxDocument, UNO_QUERY_THROW );
sDocURL = xDocStorable->getLocation();
}
sDocURL.endsWith(u"/", &sDocURL);
sal_Int32 nLastSepPos = sDocURL.lastIndexOf( '/' );
if ( ( nLastSepPos != -1 ) && ( nLastSepPos == sDocURL.getLength() - 1 ) )
{
sDocURL = sDocURL.copy( 0, nLastSepPos );
nLastSepPos = sDocURL.lastIndexOf( '/' );
}
sTitle = sDocURL.copy( nLastSepPos + 1 );
if ( !sTitle.isEmpty() )