stringsi.inc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. Processor independent part for strings and sysutils units
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. function strcat(dest,source : pchar) : pchar;
  13. begin
  14. strcopy(strend(dest),source);
  15. strcat:=dest;
  16. end;
  17. function strlcat(dest,source : pchar;l : longint) : pchar;
  18. var
  19. destend : pchar;
  20. begin
  21. destend:=strend(dest);
  22. dec(l,destend-dest);
  23. if l>0 then
  24. strlcopy(destend,source,l);
  25. strlcat:=dest;
  26. end;
  27. function strmove(dest,source : pchar;l : longint) : pchar;
  28. begin
  29. move(source^,dest^,l);
  30. strmove:=dest;
  31. end;
  32. function strpos(str1,str2 : pchar) : pchar;
  33. var
  34. p : pchar;
  35. lstr2 : longint;
  36. begin
  37. strpos:=nil;
  38. p:=strscan(str1,str2^);
  39. if p=nil then
  40. exit;
  41. lstr2:=strlen(str2);
  42. while p<>nil do
  43. begin
  44. if strlcomp(p,str2,lstr2)=0 then
  45. begin
  46. strpos:=p;
  47. exit;
  48. end;
  49. inc(longint(p));
  50. p:=strscan(p,str2^);
  51. end;
  52. end;
  53. {
  54. $Log$
  55. Revision 1.1 2000-07-13 06:30:49 michael
  56. + Initial import
  57. Revision 1.7 2000/02/09 16:59:31 peter
  58. * truncated log
  59. Revision 1.6 2000/01/07 16:41:36 daniel
  60. * copyright 2000
  61. Revision 1.5 1999/12/10 15:02:12 peter
  62. * strnew is ofcourse also different between sysutils and strings, just
  63. like stralloc/strdispose.
  64. Revision 1.4 1999/09/13 11:42:42 peter
  65. * fixed strlcat
  66. Revision 1.3 1999/09/01 09:25:10 peter
  67. * fixed return of strcat,strlcat
  68. }