[Webinar] Streamline your web hosting managementRegister Today

x
Solved

# About StrIComp function in Turbo Pascal

Posted on 2000-01-18
Medium Priority
198 Views
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?
0
Question by:HenryChang

LVL 6

Expert Comment

ID: 2365876
They have to be PCHAR type...

Var
S1,S2: PChar;
Result: Integer;

result := StrIComp(S1,S2);
0

LVL 1

Expert Comment

ID: 2366112
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

LVL 1

Expert Comment

ID: 2366118
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

Expert Comment

ID: 2366715
it's very nice answer
Good Bakry99
Elnazear
0

Author Comment

ID: 2369738
but s1 < s2 is case sensitive, eg. abd is larger than Abc.
0

LVL 6

Accepted Solution

My name is Mud earned 60 total points
ID: 2369753
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

LVL 6

Expert Comment

ID: 2369859
Hey... this was a good answer, why the "B" for???
0

LVL 1

Expert Comment

ID: 2370194
hi
olso StrIComp(@S1, @S2)  is caseSensitive
bakry
0

LVL 6

Expert Comment

ID: 2370209
>>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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It's not just another paperwork submission. Serious planning and rigour to managing the whole thought processes need to be put in place. The intent is not on drilling into the details, but to share tips in getting the first thing right to kick-start…
A recent study by Google illustrates that almost 84% of patients go for both online and offline sources for hospital research. What do you think, “Is the Healthcare Industry the next to be disrupted by Digital Marketing?”
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
###### Suggested Courses
Course of the Month8 days, 23 hours left to enroll

#### 590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.