mirror of
https://github.com/moparisthebest/Simba
synced 2025-01-30 23:00:18 -05:00
Fixed explode
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@556 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
18c43a2aa6
commit
40cb1d04ee
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user