# About StrIComp function in Turbo Pascal

I always have a message of "Type Mismatch" of the following

result := StrIComp(S1,S2);

where S1 and S2 are "String" type.  What's wrong with it?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Systems EngineerCommented:
They have to be PCHAR type...

Var
S1,S2: PChar;
Result: Integer;

result := StrIComp(S1,S2);
0
Commented:
hi
s1 & s2 most be PCHAR
but if you want them String you most write a Function like this
Function StriComp(s1, s2:String):Integer;
begin
if s1>s2 then
StriComp:=1
else
if
s1<s2 then
striComp:=-1
else
striComp:=0;
end;

Bakry
0
Commented:
hi
s1 & s2 most be PCHAR
but if you want them String you most write a Function like this
Function StriComp(s1, s2:String):Integer;
begin
if s1>s2 then
StriComp:=1
else
if
s1<s2 then
striComp:=-1
else
striComp:=0;
end;

Bakry
0
Commented:
it's very nice answer
Good Bakry99
Elnazear
0
Author Commented:
but s1 < s2 is case sensitive, eg. abd is larger than Abc.
0
Systems EngineerCommented:
USES
Strings;
var
Result: PChar;
S1, S2: String;
begin
if StrIComp(@S1, @S2) = 0 then
Result := 'equal'
else
Result := 'different';
Writeln('They are ', Result);
end.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Systems EngineerCommented:
Hey... this was a good answer, why the "B" for???
0
Commented:
hi
olso StrIComp(@S1, @S2)  is caseSensitive
bakry
0
Systems EngineerCommented:
>>abd is larger than Abc

But ofcourse... what do you expect...

StrIComp is not Case Sensitive

If you input:

this is a test
ThIs iS a tEsT

the result should be "equal".
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Pascal

From novice to tech pro — start learning today.