From: Mikko Rasa Date: Sun, 18 Mar 2007 20:21:58 +0000 (+0000) Subject: Fixed split to allow empty parts in beginning and end of string X-Git-Tag: strings-1.0~22 X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=commitdiff_plain;h=dbda1bb7f44f289c9f1c5ba9741970ac264d8e5d Fixed split to allow empty parts in beginning and end of string --- 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