What is the proper() method in Euphoria?
Overview
In Euphoria, the proper() method is a built-in sequence manipulation method used to capitalize each word arrangement in text file editing.
With the proper() method, we can easily make the first letter of all alphabetic members of a sequence capitalized. We have to make sure that all sequence members are alphabetic characters. If not, the conversion will not happen.
However, if a nested sequence contains a non-alphabetic character subsequence, the function will only affect that subsequence, while the remainder will stay unaffected.
Syntax
proper(value)
Parameters
This method takes the parameter, value, which represents the string value whose words are to be capitalized.
Return value
It returns a sequence whose words have been capitalized.
Requirement
To access this function in our program code, we have to include the text.e file in it.
std/text.e
include std/text.e--declare some sequencesequence seq1,seq2, seq3seq1 = proper("the educative edpresso platform")seq2 = proper("A PLATFORM FOR BYTE SIZED SHOTS")seq3= proper("EDUCATIVE EDPRESSO platform for dEPLOYMENT tOpIcs")printf(1,"\n %s \n %s \n %s",{seq1,seq2,seq3})
Explanation
-
Line 1: We include the
text.efile, which allows themethod()to be used in the program. -
Line 2: We declare the sequence variables.
-
Lines 4–8: We call the
proper()function to convert the members of a certain sequence, and store them in the variables we declared. -
Line 10: We use
printf()to print the value ofseq1,seq2, andseq3.