fpc/rtl/inc/stringsi.inc
1999-02-25 10:05:07 +00:00

85 lines
1.9 KiB
PHP

{
$Id$
This file is part of the Free Pascal run time library.
Copyright (c) 1999 by the Free Pascal development team
Processor independent part for strings and sysutils units
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
function strcat(dest,source : pchar) : pchar;
begin
strcat:=strcopy(strend(dest),source);
end;
function strlcat(dest,source : pchar;l : longint) : pchar;
var
destend : pchar;
begin
destend:=strend(dest);
l:=l-(destend-dest);
strlcat:=strlcopy(destend,source,l);
end;
function strmove(dest,source : pchar;l : longint) : pchar;
begin
move(source^,dest^,l);
strmove:=dest;
end;
function strpos(str1,str2 : pchar) : pchar;
var
p : pchar;
lstr2 : longint;
begin
strpos:=nil;
p:=strscan(str1,str2^);
if p=nil then
exit;
lstr2:=strlen(str2);
while p<>nil do
begin
if strlcomp(p,str2,lstr2)=0 then
begin
strpos:=p;
exit;
end;
inc(longint(p));
p:=strscan(p,str2^);
end;
end;
function strnew(p : pchar) : pchar;
var
len : longint;
begin
strnew:=nil;
if (p=nil) or (p^=#0) then
exit;
len:=strlen(p)+1;
getmem(strnew,len);
if strnew<>nil then
strmove(strnew,p,len);
end;
{
$Log$
Revision 1.2 1999-02-25 10:05:07 michael
+ Added header and log
}