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: old style s...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 725 of 811
Post > Topic >>

Re: old style strings

by "sickfile" <spacerogue5@[EMAIL PROTECTED] > Mar 7, 2007 at 11:25 PM

On Mar 8, 4:28 am, "Richard Engebretson" <e...@[EMAIL PROTECTED]
> wrote:
> Here is a fun little program to learn some old string techniques;
>
> Program StringPlay;
> Var
>    r, s : string;
>    i, CharNum : longint;
> Begin
>    for i := 1 to 10 do
>    begin
>       readln(r); if r = 'quit' then exit;
>       CharNum := ord(r[1]); writeln('r[1] is ', Charnum);
>       readln(s); if s = 'quit' then exit;
>       CharNum := ord(s[1]); writeln('s[1] is ',  CharNum);
>
>       if r < s then writeln('input not same; r<s');
>       if r > s then writeln('input not same; r>s');
>
>       r := upcase(r); s:= upcase(s);
>       if r < s then writeln('upcase not same; r<s');
>       if r > s then writeln('upcase not same; r>s');
>
>       writeln(r, ' ', s);
>    end;{for loop}
> end.
>
> I hope I typed that OK. Anyway, old fa****oned ASCII combined with old
> fa****oned Pascal has some nice features. Freepascal extended the
> upcase function.
>
> New users and slow learners might find these programming features
> interesting.


Good. We can change line 15 (r := upcase(r); s:= upcase(s);) to:

      for CharNum := 1 to length (r) do r[CharNum] := upcase
(r[CharNum]);
      for CharNum := 1 to length (s) do s[CharNum] := upcase
(s[CharNum]);

Makes it work in Turbo Pascal.
 




 2 Posts in Topic:
old style strings
"Richard Engebretson  2007-03-07 19:28:58 
Re: old style strings
"sickfile" <  2007-03-07 23:25:10 

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:32 CDT 2008.