Make use of std string_view
Change-Id: Ic4b330b7d046ba77e51d32d156501a18e3782985 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
8d83c29905
commit
f3da84db23
@@ -30,6 +30,7 @@
|
|||||||
#include <rtl/ustrbuf.hxx>
|
#include <rtl/ustrbuf.hxx>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
namespace logging
|
namespace logging
|
||||||
{
|
{
|
||||||
@@ -91,12 +92,7 @@ namespace
|
|||||||
|
|
||||||
bool needsQuoting(const OUString& str)
|
bool needsQuoting(const OUString& str)
|
||||||
{
|
{
|
||||||
static const OUString quote_trigger_chars = "\",\n\r";
|
return std::u16string_view(str).find_first_of(u"\",\n\r") != std::u16string_view::npos;
|
||||||
sal_Int32 len = str.getLength();
|
|
||||||
for(sal_Int32 i=0; i<len; i++)
|
|
||||||
if(quote_trigger_chars.indexOf(str[i])!=-1)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void appendEncodedString(OUStringBuffer& buf, const OUString& str)
|
void appendEncodedString(OUStringBuffer& buf, const OUString& str)
|
||||||
|
Reference in New Issue
Block a user