Case conversion is a common function amongst all programing languages. In the same vein, Euphoria language has provision for converting an atom or sequence from uppercase to lowercase and vice versa.
To do this in Euphoria, we use two functions:
lower()
functionupper()
functionThe lower()
function will convert an uppercase sequence or atom strings to lower case.
The upper()
function will convert an uppercase sequence or atom strings to lower case.
lowwer(value_to_converted)
upper(value_to_converted)
This function takes the parameter, value_to_converted
, which represents the string sequence.
Note: To use this function, we have to import the
text.e
file from Euphoria’s core standard library into our program.
include std/text.e --declare some sequence variable sequence conv1, conv2, increase, decrease --assign values conv1 = "PINgING" conv2 = "changing" -- carry out case casting using lower and upper methods decrease = lower(conv1) increase = upper(conv2) --print outcome to output printf(1,"\"PINgING\" To lowercase: %s",{ decrease}) printf(1,"\n\"changing\" To uppercase: %s",{increase})
text
file.lower()
and upper()
method on variables conv1
and conv2
, and save the output in decrease
and increase
respectively.printf
to print the output.RELATED TAGS
CONTRIBUTOR
View all Courses