Jump to content

Idiomatically determine all the lowercase and uppercase letters: Difference between revisions

no edit summary
(Added XPL0 example.)
No edit summary
Line 40:
Lower case: abcdefghijklmnopqrstuvwxyz
Upper case: ABCDEFGHIJKLMNOPQRSTUVWXYZ
</pre>
 
=={{header|Ada}}==
Creates two subtypes of the standard type Character. Subtype Lower is defined to be all the characters from 'a' to 'z'. Subtype Upper is defined to be all characters from 'A' to 'Z'. This program works with any version of Ada.
<lang Ada>
with Ada.Text_IO; use Ada.Text_IO;
 
procedure Main is
subtype Lower is Character range 'a' .. 'z';
subtype Upper is Character range 'A' .. 'Z';
begin
Put ("Lower: ");
for c in Lower'range loop
Put (c);
end loop;
New_Line;
Put ("Upper: ");
for c in Upper'range loop
Put (c);
end loop;
New_Line;
end Main;
</lang>
{{Output}}
<pre>
Lower: abcdefghijklmnopqrstuvwxyz
Upper: ABCDEFGHIJKLMNOPQRSTUVWXYZ
</pre>
 
82

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.