From 135c6601bd9d12bd935371d3122f8e75391de75b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 21 Nov 2017 18:07:00 +0000 Subject: Add {Byte/Wide}String::Trim(). So callers no longer have to call str.TrimLeft(); str.TrimRight(); Change-Id: If931eaa8d891f487b9618ebbeee5ee294e807846 Reviewed-on: https://pdfium-review.googlesource.com/18990 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index bc6c7dbe13..2c13b92d4e 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -853,20 +853,17 @@ bool CPDFXFA_DocEnvironment::MailToInfo(WideString& csURL, tmp = srcURL.Left(pos.value()); tmp = tmp.Right(tmp.GetLength() - 7); } - tmp.TrimLeft(); - tmp.TrimRight(); + tmp.Trim(); csToAddress = tmp; srcURL = srcURL.Right(srcURL.GetLength() - (pos.value() + 1)); while (!srcURL.IsEmpty()) { - srcURL.TrimLeft(); - srcURL.TrimRight(); + srcURL.Trim(); pos = srcURL.Find(L'&'); tmp = (!pos.has_value()) ? srcURL : srcURL.Left(pos.value()); - tmp.TrimLeft(); - tmp.TrimRight(); + tmp.Trim(); if (tmp.GetLength() >= 3 && tmp.Left(3).CompareNoCase(L"cc=") == 0) { tmp = tmp.Right(tmp.GetLength() - 3); if (!csCCAddress.IsEmpty()) @@ -922,8 +919,7 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, case XFA_ATTRIBUTEENUM_Xdp: { WideString csContent; submitData.GetSubmitXDPContent(csContent); - csContent.TrimLeft(); - csContent.TrimRight(); + csContent.Trim(); WideString space; space.FromLocal(" "); csContent = space + csContent + space; -- cgit v1.2.3