From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d25bdbf13c9589c X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: How to do case conversion? Date: 1996/08/11 Message-ID: #1/1 X-Deja-AN: 173574465 references: <320D5A34.41C67EA6@cs.cmu.edu> <01bb87b9$4194f040$138371a5@dhoossr.iquest.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-08-11T00:00:00+00:00 List-Id: David Hoos points out that Ada.Characters.Handling contains ready made routines that use the maps in Ada.Strings.Maps.Constants, and yes, you may as well use them if they fit. The coding is quite trivial: function To_Lower (Item : in Character) return Character is begin return Value (Lower_Case_Map, Item); end To_Lower; function To_Lower (Item : in String) return String is Result : String (1 .. Item'Length); begin for J in Item'Range loop Result (J - (Item'First - 1)) := Value (Lower_Case_Map, Item (J)); end loop; return Result; end To_Lower; It is Lower_Case_Map that is the difficult part! Note that in Ada 95 days it is better if you can to always use this map rather than the old add/subtract 32 ASCII trick, since that way your code work fine for all Latin-1 letters without any extra effort on your part, and indeed in an implementation with localizations of these packages for other Latin sets, your code will still work.