Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Misc > Re: Comparing t...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 8 Topic 768 of 811
Post > Topic >>

Re: Comparing to strings

by CBFalconer <cbfalconer@[EMAIL PROTECTED] > Dec 10, 2007 at 04:42 AM

Alan wrote:
> Joe wrote:
> 
>> Can some one tell me How to compare 2 strings
>>
>> var
>> s1, s2: string
>>
>> s1:= 'John';
>> s2:= 'john';
>>
>> How could I compare the 2 strings to get a match
> 
> if s1 = s2 then
>   writeln('strings match');
> 
> Of course, in your example the test would fail because the case
> doesn't match.

You also need to correct the code.  Add a ';' after string in the
var section.  Add a definition for string ahead in the type
section:

  TYPE
     string = array[1..4] of char;

unless you are using some sort of non-standard Pascal with a
predefined string type.

-- 
Merry Christmas, Happy Hanukah, Happy New Year
        Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
     <http://cbfalconer.home.att.net>



-- 
Posted via a free Usenet account from http://www.teranews.com
 




 8 Posts in Topic:
Comparing to strings
Joe <joe@[EMAIL PROTEC  2007-12-09 22:33:06 
Re: Comparing to strings
Alan <alan@[EMAIL PROT  2007-12-10 03:58:00 
Re: Comparing to strings
CBFalconer <cbfalconer  2007-12-10 04:42:22 
Re: Comparing to strings
Joe <joe@[EMAIL PROTEC  2007-12-10 16:56:02 
Re: Comparing to strings
Keith Bowes <keith_bow  2007-12-23 05:00:04 
Re: Comparing to strings
Joe <joe@[EMAIL PROTEC  2007-12-10 10:20:22 
Re: Comparing to strings
Marco van de Voort <ma  2007-12-10 08:47:39 
Re: Comparing to strings
Joe <joe@[EMAIL PROTEC  2007-12-10 16:58:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 0:50:08 CDT 2008.