Re: [fpc-pascal] any free pascal standard function to compare a, string against an array of string?

2018-10-10 Thread Ingemar Ragnemalm


You mean something faster than a for-loop? Like a hash table?

I don't know of any hash table in the standard library but there are 
some in the class library:


https://www.freepascal.org/docs-html/fcl/contnrs/tfpstringhashtable.html
https://www.freepascal.org/docs-html/fcl/contnrs/tfphashlist.html

I have not used these myself but they may suit your problem.

Or you can just write your own hash table function. It is not that hard.

/Ingemar

Den 2018-10-10 kl. 17:31, skrev fpc-pascal-requ...@lists.freepascal.org:

is there a function like
    if    IsOneOf('subtext', ['abc','cde','fecg','hig'])   then begin
...
end;

is there such a function IsOneOf(TheSubString : String; const TheStrings
: array of String) : Boolean
?
if yes, what is its name and unit?


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] any free pascal standard function to compare a string against an array of string?

2018-10-10 Thread David Copeland
Dennis,

Look at AnsiMatchStr in strutils.

Dave.

On 2018-10-10 11:11 a.m., Dennis wrote:
> is there a function like
>   if    IsOneOf('subtext', ['abc','cde','fecg','hig'])   then begin
> ...
> end;
>
> is there such a function IsOneOf(TheSubString : String; const
> TheStrings : array of String) : Boolean
> ?
> if yes, what is its name and unit?
>
> Dennis
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


-- 
David Copeland
JSI Data Systems Limited
613-727-9353
www.jsidata.ca

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] any free pascal standard function to compare a string against an array of string?

2018-10-10 Thread OBones

Hello,

I would use IndexStr from StrUtils: 
https://www.freepascal.org/docs-html/rtl/strutils/indexstr.html


  if IndexStr('subtext', ['abc','cde','fecg','hig']) >= 0  then

Regards

Dennis wrote:

is there a function like
  if    IsOneOf('subtext', ['abc','cde','fecg','hig'])   then begin
...
end;

is there such a function IsOneOf(TheSubString : String; const 
TheStrings : array of String) : Boolean

?
if yes, what is its name and unit?

Dennis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] any free pascal standard function to compare a string against an array of string?

2018-10-10 Thread Michael Van Canneyt



On Wed, 10 Oct 2018, Dennis wrote:


is there a function like
  if    IsOneOf('subtext', ['abc','cde','fecg','hig'])   then begin
...
end;

is there such a function IsOneOf(TheSubString : String; const TheStrings 
: array of String) : Boolean

?
if yes, what is its name and unit?


IndexStr in strutils:

https://www.freepascal.org/docs-html/current/rtl/strutils/indexstr.html

Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] any free pascal standard function to compare a string against an array of string?

2018-10-10 Thread Dennis

is there a function like
  if    IsOneOf('subtext', ['abc','cde','fecg','hig'])   then begin
...
end;

is there such a function IsOneOf(TheSubString : String; const TheStrings 
: array of String) : Boolean

?
if yes, what is its name and unit?

Dennis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal