function lowcase(s: string): string;

Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
Black Magic Black Magic is offline Offline Jun 28th, 2009, 9:10 am |
0
A simple function that converts alphabetic values into their respective lowercase value.
Quick reply to this message  
Pascal and Delphi Syntax
  1. function lowcase(s: string): string;
  2. var
  3. i: integer;
  4. begin
  5. s := upcase(s);
  6.  
  7. for i := 1 to length(s) do
  8. begin
  9. if s[i] in ['A'..'z'] then // this is to check that s[i] is alphabetic
  10. begin
  11. s[i] := chr(ord(s[i]) + 32); // convert s[i] to a numeric value, then + 32 to it, and convert the final numeric value into a char
  12. end;
  13. end;
  14. lowcase := s;
  15. end;

Message:


Thread Tools Search this Thread



Tag cloud for Pascal and Delphi
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC