From dbda1bb7f44f289c9f1c5ba9741970ac264d8e5d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 18 Mar 2007 20:21:58 +0000 Subject: [PATCH] Fixed split to allow empty parts in beginning and end of string --- source/utils.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/utils.cpp b/source/utils.cpp index 55b191f..0ed3fc1 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -59,17 +59,29 @@ Splits a string to parts. vector split(const string &str, const string &sep, bool allow_empty) { vector result; - unsigned start=str.find_first_not_of(sep); + + unsigned start=0; + if(!allow_empty) + start=str.find_first_not_of(sep); + while(start