From 40cb1d04ee92ef1187eda559e1561298322f6227 Mon Sep 17 00:00:00 2001 From: Raymond Date: Fri, 26 Feb 2010 01:32:23 +0000 Subject: [PATCH] Fixed explode git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@556 3f818213-9676-44b0-a9b4-5e4c4e03d09d --- trunk/Units/MMLAddon/stringutil.pas | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/trunk/Units/MMLAddon/stringutil.pas b/trunk/Units/MMLAddon/stringutil.pas index f279111..de4a962 100644 --- a/trunk/Units/MMLAddon/stringutil.pas +++ b/trunk/Units/MMLAddon/stringutil.pas @@ -44,7 +44,7 @@ begin; lenstr := length(str); // for i := 1 to lenstr do i := 1; - while i < lenstr do + while i <= lenstr do begin; if not ((i + lendel - 1) > lenstr) then begin @@ -62,19 +62,17 @@ begin; result[lenres-1] := Copy(str,lastpos,i-lastpos); lastpos := i+lendel; i := i + lendel-1;//Dirty + if i = lenstr then //This was the trailing delimiter + exit; end; - end else //We cannot possibly find a delimiter anymore, thus copy the rest of the string + end else //We cannot possibly find a delimiter anymore, thus copy the rest of the string and exit Break; inc(i); end; //Copy the rest of the string (if it's not a delimiter) - if (lenstr - lastpos + 1) = 0 then - exit; inc(lenres); setlength(result,lenres); result[lenres-1] := Copy(str,lastpos,lenstr - lastpos + 1); - if result[lenres-1] = del then - result[lenres-1] := ''; end; function Capitalize(str : string) : string;