* made inster(string,string,index) a bit faster

+ overloaded insert(char,string,index)
This commit is contained in:
Jonas Maebe 1999-01-11 19:26:53 +00:00
parent 5de65a9810
commit f7b137cdef
2 changed files with 26 additions and 3 deletions

View File

@ -60,7 +60,21 @@ begin
dec(index)
else
index:=0;
s:=Copy(s,1,Index)+source+Copy(s,Index+1,length(s));
{ s:=Copy(s,1,Index)+source+Copy(s,Index+1,length(s));}
move(s[Index+1],s[Index+Length(Source)+1], Length(s)-Index);
move(Source[1],s[Index+1],Length(Source));
Inc(Byte(s[0]),Byte(source[0]));
end;
procedure insert(source : Char;var s : shortstring;index : StrLenInt);
begin
if index>1 then
dec(index)
else
index:=0;
move(s[Index+1],s[Index+2], Length(s)-Index);
s[Index+1] := Source;
Inc(Byte(s[0]));
end;
@ -937,7 +951,11 @@ end;
{
$Log$
Revision 1.17 1998-12-15 22:43:02 peter
Revision 1.18 1999-01-11 19:26:55 jonas
* made inster(string,string,index) a bit faster
+ overloaded insert(char,string,index)
Revision 1.17 1998/12/15 22:43:02 peter
* removed temp symbols
Revision 1.16 1998/11/05 10:29:34 pierre

View File

@ -188,6 +188,7 @@ function strlen(p:pchar):longint;
Function Copy(const s:shortstring;index:StrLenInt;count:StrLenInt):shortstring;
Procedure Delete(Var s:shortstring;index:StrLenInt;count:StrLenInt);
Procedure Insert(const source:shortstring;Var s:shortstring;index:StrLenInt);
Procedure Insert(source:Char;Var s:shortstring;index:StrLenInt);
Function Pos(const substr:shortstring;const s:shortstring):StrLenInt;
Function Pos(C:Char;const s:shortstring):StrLenInt;
Procedure SetLength(var s:shortstring;len:StrLenInt);
@ -430,7 +431,11 @@ const
{
$Log$
Revision 1.46 1998-12-28 15:50:48 peter
Revision 1.47 1999-01-11 19:26:53 jonas
* made inster(string,string,index) a bit faster
+ overloaded insert(char,string,index)
Revision 1.46 1998/12/28 15:50:48 peter
+ stdout, which is needed when you write something in the system unit
to the screen. Like the runtime error