mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 21:49:15 +02:00
+ added pos(char,ansistring), because there is also a pos(char,shortstring)
and without the ansistring version, the shortstring version is always called when calling pos(char,pchar), even when using $h+ (because the first parameter matches exactly) (merged)
This commit is contained in:
parent
06603cf428
commit
4a7f3db6d9
@ -520,6 +520,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ Faster version for a char alone. Must be implemented because }
|
||||||
|
{ pos(c: char; const s: shortstring) also exists, so otherwise }
|
||||||
|
{ using pos(char,pchar) will always call the shortstring version }
|
||||||
|
{ (exact match for first argument), also with $h+ (JM) }
|
||||||
|
Function Pos (c : Char; Const s : AnsiString) : Longint;
|
||||||
|
var
|
||||||
|
i: longint;
|
||||||
|
begin
|
||||||
|
for i:=1 to length(s) do
|
||||||
|
if s[i]=c then
|
||||||
|
begin
|
||||||
|
pos:=i;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
pos:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function ValAnsiFloat(Const S : AnsiString; Var Code : ValSInt): ValReal; [public, alias:'FPC_VAL_REAL_ANSISTR'];
|
Function ValAnsiFloat(Const S : AnsiString; Var Code : ValSInt): ValReal; [public, alias:'FPC_VAL_REAL_ANSISTR'];
|
||||||
Var
|
Var
|
||||||
SS : String;
|
SS : String;
|
||||||
@ -668,7 +686,13 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.7 2000-11-06 20:34:24 peter
|
Revision 1.8 2000-12-08 14:04:43 jonas
|
||||||
|
+ added pos(char,ansistring), because there is also a pos(char,shortstring)
|
||||||
|
and without the ansistring version, the shortstring version is always
|
||||||
|
called when calling pos(char,pchar), even when using $h+ (because the
|
||||||
|
first parameter matches exactly) (merged)
|
||||||
|
|
||||||
|
Revision 1.7 2000/11/06 20:34:24 peter
|
||||||
* changed ver1_0 defines to temporary defs
|
* changed ver1_0 defines to temporary defs
|
||||||
|
|
||||||
Revision 1.6 2000/10/21 18:20:17 florian
|
Revision 1.6 2000/10/21 18:20:17 florian
|
||||||
|
@ -312,6 +312,7 @@ Procedure UniqueString (Var S : AnsiString);
|
|||||||
Function Length (Const S : AnsiString) : Longint;
|
Function Length (Const S : AnsiString) : Longint;
|
||||||
Function Copy (Const S : AnsiString; Index,Size : Longint) : AnsiString;
|
Function Copy (Const S : AnsiString; Index,Size : Longint) : AnsiString;
|
||||||
Function Pos (Const Substr : AnsiString; Const Source : AnsiString) : Longint;
|
Function Pos (Const Substr : AnsiString; Const Source : AnsiString) : Longint;
|
||||||
|
Function Pos (c : Char; Const s : AnsiString) : Longint;
|
||||||
Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : Longint);
|
Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : Longint);
|
||||||
Procedure Delete (Var S : AnsiString; Index,Size: Longint);
|
Procedure Delete (Var S : AnsiString; Index,Size: Longint);
|
||||||
Function StringOfChar(c : char;l : longint) : AnsiString;
|
Function StringOfChar(c : char;l : longint) : AnsiString;
|
||||||
@ -485,7 +486,13 @@ const
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.13 2000-12-07 17:19:47 jonas
|
Revision 1.14 2000-12-08 14:04:43 jonas
|
||||||
|
+ added pos(char,ansistring), because there is also a pos(char,shortstring)
|
||||||
|
and without the ansistring version, the shortstring version is always
|
||||||
|
called when calling pos(char,pchar), even when using $h+ (because the
|
||||||
|
first parameter matches exactly) (merged)
|
||||||
|
|
||||||
|
Revision 1.13 2000/12/07 17:19:47 jonas
|
||||||
* new constant handling: from now on, hex constants >$7fffffff are
|
* new constant handling: from now on, hex constants >$7fffffff are
|
||||||
parsed as unsigned constants (otherwise, $80000000 got sign extended
|
parsed as unsigned constants (otherwise, $80000000 got sign extended
|
||||||
and became $ffffffff80000000), all constants in the longint range
|
and became $ffffffff80000000), all constants in the longint range
|
||||||
|
Loading…
Reference in New Issue
Block a user