From 005af9c2c396b32f444791489f186905872c93f2 Mon Sep 17 00:00:00 2001 From: psychon Date: Thu, 8 May 2008 13:23:47 +0000 Subject: [PATCH] CString::Split(): Skip empty tokens at the beginning for bAllowEmpty = false git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1041 726aef4b-f618-498e-8847-2d620e286838 --- String.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/String.cpp b/String.cpp index 38ec9b12..93afc57f 100644 --- a/String.cpp +++ b/String.cpp @@ -577,6 +577,12 @@ unsigned int CString::Split(const CString& sDelim, VCString& vsRet, bool bAllowE unsigned int uRightLen = sRight.length(); const char* p = c_str(); + if (!bAllowEmpty) { + while (strncasecmp(p, sDelim.c_str(), uDelimLen) == 0) { + p += uDelimLen; + } + } + while (*p) { if (uLeftLen && uRightLen && !bInside && strncasecmp(p, sLeft.c_str(), uLeftLen) == 0) { p += uLeftLen;