mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 13:49:07 +02:00
* some parts of strutils cleaned up, bug #3124 fixed
git-svn-id: trunk@459 -
This commit is contained in:
parent
07442c5693
commit
67d640ad13
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -5914,6 +5914,7 @@ tests/webtbs/tw3104.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw3109.pp svneol=native#text/plain
|
tests/webtbs/tw3109.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3111.pp svneol=native#text/plain
|
tests/webtbs/tw3111.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3113.pp svneol=native#text/plain
|
tests/webtbs/tw3113.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw3124.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3131.pp svneol=native#text/plain
|
tests/webtbs/tw3131.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3137.pp svneol=native#text/plain
|
tests/webtbs/tw3137.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3143.pp svneol=native#text/plain
|
tests/webtbs/tw3143.pp svneol=native#text/plain
|
||||||
|
@ -22,7 +22,7 @@ uses
|
|||||||
SysUtils{, Types};
|
SysUtils{, Types};
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
Case sensitive search/replace
|
Case insensitive search/replace
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
Function AnsiResemblesText(const AText, AOther: string): Boolean;
|
Function AnsiResemblesText(const AText, AOther: string): Boolean;
|
||||||
@ -34,7 +34,7 @@ Function AnsiMatchText(const AText: string; const AValues: array of string): Boo
|
|||||||
Function AnsiIndexText(const AText: string; const AValues: array of string): Integer;
|
Function AnsiIndexText(const AText: string; const AValues: array of string): Integer;
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
Case insensitive search/replace
|
Case sensitive search/replace
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
Function AnsiContainsStr(const AText, ASubText: string): Boolean;
|
Function AnsiContainsStr(const AText, ASubText: string): Boolean;
|
||||||
@ -188,9 +188,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
Case sensitive search/replace
|
Case insensitive search/replace
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
Function AnsiResemblesText(const AText, AOther: string): Boolean;
|
Function AnsiResemblesText(const AText, AOther: string): Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -203,17 +202,17 @@ end;
|
|||||||
Function AnsiContainsText(const AText, ASubText: string): Boolean;
|
Function AnsiContainsText(const AText, ASubText: string): Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
AnsiContainsText:=Pos(ASubText,AText)<>0;
|
AnsiContainsText:=AnsiPos(ASubText,AText)<>0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function AnsiStartsText(const ASubText, AText: string): Boolean;
|
Function AnsiStartsText(const ASubText, AText: string): Boolean;
|
||||||
begin
|
begin
|
||||||
Result:=Copy(AText,1,Length(AsubText))=ASubText;
|
Result:=AnsiCompareText(Copy(AText,1,Length(AsubText)),ASubText)=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function AnsiEndsText(const ASubText, AText: string): Boolean;
|
Function AnsiEndsText(const ASubText, AText: string): Boolean;
|
||||||
begin
|
begin
|
||||||
result:=Copy(AText,Length(AText)-Length(ASubText)+1,Length(ASubText))=asubtext;
|
result:=AnsiCompareText(Copy(AText,Length(AText)-Length(ASubText)+1,Length(ASubText)),asubtext)=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function AnsiReplaceText(const AText, AFromText, AToText: string): string;
|
Function AnsiReplaceText(const AText, AFromText, AToText: string): string;
|
||||||
@ -262,13 +261,13 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
{ ---------------------------------------------------------------------
|
{ ---------------------------------------------------------------------
|
||||||
Case insensitive search/replace
|
Case sensitive search/replace
|
||||||
---------------------------------------------------------------------}
|
---------------------------------------------------------------------}
|
||||||
|
|
||||||
Function AnsiContainsStr(const AText, ASubText: string): Boolean;
|
Function AnsiContainsStr(const AText, ASubText: string): Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := Pos(ASubText,AText)<>0;
|
Result := AnsiPos(ASubText,AText)<>0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -276,7 +275,7 @@ end;
|
|||||||
Function AnsiStartsStr(const ASubText, AText: string): Boolean;
|
Function AnsiStartsStr(const ASubText, AText: string): Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := Pos(ASubText,AText)=1;
|
Result := AnsiPos(ASubText,AText)=1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -284,7 +283,7 @@ end;
|
|||||||
Function AnsiEndsStr(const ASubText, AText: string): Boolean;
|
Function AnsiEndsStr(const ASubText, AText: string): Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := Pos(ASubText,AText)=(length(AText)-length(ASubText)+1);
|
Result := AnsiPos(ASubText,AText)=(length(AText)-length(ASubText)+1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
22
tests/webtbs/tw3124.pp
Normal file
22
tests/webtbs/tw3124.pp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{ Source provided for Free Pascal Bug Report 3124 }
|
||||||
|
{ Submitted by "Radoslaw Stachowiak" on 2004-05-29 }
|
||||||
|
{ e-mail: zenek_tm@tenbit.pl }
|
||||||
|
program strtest;
|
||||||
|
{$apptype console}
|
||||||
|
{$ifdef fpc}
|
||||||
|
{$mode objfpc}
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
uses strutils;
|
||||||
|
|
||||||
|
var
|
||||||
|
a, b: ansistring;
|
||||||
|
|
||||||
|
begin
|
||||||
|
a:='aaaa';
|
||||||
|
b:='AaAa';
|
||||||
|
if AnsiStartsText(a, b) then
|
||||||
|
writeln('ok')
|
||||||
|
else
|
||||||
|
halt(1);
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user