Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
30
Task/String-case/Modula-3/string-case.mod3
Normal file
30
Task/String-case/Modula-3/string-case.mod3
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
MODULE TextCase EXPORTS Main;
|
||||
|
||||
IMPORT IO, Text, ASCII;
|
||||
|
||||
PROCEDURE Upper(txt: TEXT): TEXT =
|
||||
VAR
|
||||
len := Text.Length(txt);
|
||||
res := "";
|
||||
BEGIN
|
||||
FOR i := 0 TO len - 1 DO
|
||||
res := Text.Cat(res, Text.FromChar(ASCII.Upper[Text.GetChar(txt, i)]));
|
||||
END;
|
||||
RETURN res;
|
||||
END Upper;
|
||||
|
||||
PROCEDURE Lower(txt: TEXT): TEXT =
|
||||
VAR
|
||||
len := Text.Length(txt);
|
||||
res := "";
|
||||
BEGIN
|
||||
FOR i := 0 TO len - 1 DO
|
||||
res := Text.Cat(res, Text.FromChar(ASCII.Lower[Text.GetChar(txt, i)]));
|
||||
END;
|
||||
RETURN res;
|
||||
END Lower;
|
||||
|
||||
BEGIN
|
||||
IO.Put(Upper("alphaBETA\n"));
|
||||
IO.Put(Lower("alphaBETA\n"));
|
||||
END TextCase.
|
||||
Loading…
Add table
Add a link
Reference in a new issue