diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-21 16:08:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-22 13:29:40 +0200 |
commit | ca1027e7d3a47402a016dba26d12db93b097a856 (patch) | |
tree | 666c4045bd72c8ed63a674438fcbcc41df6e3235 /unotools | |
parent | 08a72cbb06776e83475e70e0ee5d6c0ca572944e (diff) |
use more string_view in unotools
Change-Id: If32767647d3fba22a8e4a2b10fc57f47efca01d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133270
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/misc/datetime.cxx | 14 | ||||
-rw-r--r-- | unotools/source/misc/fontdefs.cxx | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx index f1b1d6a8a33e..db7216ffa268 100644 --- a/unotools/source/misc/datetime.cxx +++ b/unotools/source/misc/datetime.cxx @@ -303,25 +303,25 @@ OUString toISO8601(const css::util::DateTime& rDateTime) } /** convert ISO8601 DateTime String to util::DateTime */ -bool ISO8601parseDateTime(const OUString &rString, css::util::DateTime& rDateTime) +bool ISO8601parseDateTime(std::u16string_view rString, css::util::DateTime& rDateTime) { bool bSuccess = true; - OUString aDateStr, aTimeStr; + std::u16string_view aDateStr, aTimeStr; css::util::Date aDate; css::util::Time aTime; - sal_Int32 nPos = rString.indexOf( 'T' ); - if ( nPos >= 0 ) + size_t nPos = rString.find( 'T' ); + if ( nPos != std::u16string_view::npos ) { - aDateStr = rString.copy( 0, nPos ); - aTimeStr = rString.copy( nPos + 1 ); + aDateStr = rString.substr( 0, nPos ); + aTimeStr = rString.substr( nPos + 1 ); } else aDateStr = rString; // no separator: only date part bSuccess = ISO8601parseDate(aDateStr, aDate); - if ( bSuccess && !aTimeStr.isEmpty() ) // time is optional + if ( bSuccess && !aTimeStr.empty() ) // time is optional { bSuccess = ISO8601parseTime(aTimeStr, aTime); } diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index 9015f93e9de6..4a07087fd71f 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -457,14 +457,14 @@ OUString GetEnglishSearchFontName(std::u16string_view rInName) return rNameStr; } -OUString GetNextFontToken( const OUString& rTokenStr, sal_Int32& rIndex ) +std::u16string_view GetNextFontToken( const OUString& rTokenStr, sal_Int32& rIndex ) { // check for valid start index sal_Int32 nStringLen = rTokenStr.getLength(); if( rIndex >= nStringLen ) { rIndex = -1; - return OUString(); + return {}; } // find the next token delimiter and return the token substring @@ -498,7 +498,7 @@ OUString GetNextFontToken( const OUString& rTokenStr, sal_Int32& rIndex ) } } - return rTokenStr.copy( nTokenStart, nTokenLen ); + return rTokenStr.subView( nTokenStart, nTokenLen ); } static bool ImplIsFontToken( const OUString& rName, std::u16string_view rToken ) |