mirror of
https://github.com/moparisthebest/Simba
synced 2025-02-07 10:40:19 -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);
|
lenstr := length(str);
|
||||||
// for i := 1 to lenstr do
|
// for i := 1 to lenstr do
|
||||||
i := 1;
|
i := 1;
|
||||||
while i < lenstr do
|
while i <= lenstr do
|
||||||
begin;
|
begin;
|
||||||
if not ((i + lendel - 1) > lenstr) then
|
if not ((i + lendel - 1) > lenstr) then
|
||||||
begin
|
begin
|
||||||
@ -62,19 +62,17 @@ begin;
|
|||||||
result[lenres-1] := Copy(str,lastpos,i-lastpos);
|
result[lenres-1] := Copy(str,lastpos,i-lastpos);
|
||||||
lastpos := i+lendel;
|
lastpos := i+lendel;
|
||||||
i := i + lendel-1;//Dirty
|
i := i + lendel-1;//Dirty
|
||||||
|
if i = lenstr then //This was the trailing delimiter
|
||||||
|
exit;
|
||||||
end;
|
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;
|
Break;
|
||||||
inc(i);
|
inc(i);
|
||||||
end;
|
end;
|
||||||
//Copy the rest of the string (if it's not a delimiter)
|
//Copy the rest of the string (if it's not a delimiter)
|
||||||
if (lenstr - lastpos + 1) = 0 then
|
|
||||||
exit;
|
|
||||||
inc(lenres);
|
inc(lenres);
|
||||||
setlength(result,lenres);
|
setlength(result,lenres);
|
||||||
result[lenres-1] := Copy(str,lastpos,lenstr - lastpos + 1);
|
result[lenres-1] := Copy(str,lastpos,lenstr - lastpos + 1);
|
||||||
if result[lenres-1] = del then
|
|
||||||
result[lenres-1] := '';
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function Capitalize(str : string) : string;
|
function Capitalize(str : string) : string;
|
||||||
|
Loading…
Reference in New Issue
Block a user